FPGA 的筆記總結(未完結。。。)

2021-09-19 17:07:05 字數 2487 閱讀 8223

組合邏輯是指輸出只與當前的輸入邏輯電平有關,與電路的原始狀態無關的邏輯電路,屬於無記憶電路,常用於多路器、加法器、解碼器等

問號表示式的形式

assign data_out = en ? a:b;

一般的應用主要在三段式狀態機中的狀態轉移判斷中,三段式狀態機語句分別為:次態遷移到現態、狀態轉移條件判斷、次態暫存器輸出。

//引數宣告

parameter idle = 2'b00;

parameter s0 = 2'b01;

parameter s1 = 2'b10;

//內部訊號宣告

reg[1:0] current_state;

reg[1:0] next_state;

//訊號輸出

reg data_out;

//第一段:狀態暫存器的儲存

always @ (posedge clk or negedge rst_n)

begin

if(!rst_n)

current_state <= idle;

else

current_state <= next_state;

end//第二段 次態的組合邏輯

always @ (w_i or current_state)

begin

case(current_state)

idle:begin

if(w_i) next_state = s0;

else next_state = idle;

end

s0: begin

if(w_i) next_state = s1;

else next_state = idle;

end

s1: begin

if(w_i) next_state = s1;

else next_state = idle;

end

default : next_state = 2'bxx;

endcase

end//第三段:輸出邏輯

always @ (*)

beign

case(current)

idle: data_out = 1'b0;

s0: data_out = 1'b0;

s1: data_out = 1'b1;

default: data_out = 1'bz;

endcase

end

時序邏輯電路是含有儲存元件(如d觸發器)能夠暫存資訊,有記憶性,一般通過always語句塊實現,可以利用posedge和negedge來捕獲時鐘上公升或下降沿描述時序邏輯電路。

框圖

代 碼如1.2節

[框圖]

**

//第一段:狀態暫存器的儲存

always @ (posedge clk )

begin

current_state <= next_state;

end//第二段 組合邏輯和狀態輸出

always @ (w_i or current_state)

begin

case(current_state)

idle:begin

data_out = 1'bz;

if(w_i) next_state = s0;

else next_state = idle;

end

s0: begin

data_out = 1'b0;

if(w_i) next_state = s1;

else next_state = idle;

end

s1: begin

data_out = 1'b1;

if(w_i) next_state = s1;

else next_state = idle;

end

default : next_state = 2'bxx;

endcase

end

描述

您可以使用quartus®ii軟體通過以下步驟生成自定義的ipcore:

1.建立乙個新專案,新增客戶verilog / vhdl**檔案,然後將此檔案設定為頂級實體。然後執行analysis&elaboration。

2.選擇quartus ii軟體選單(project - > export design partation …)並生成***.qxp檔案。

3.使用生成的***.qxp檔案作為ipcore。

Spring總結(未完結)

1.什麼是spring 是乙個輕量級 實現了控制反轉 提供了面向切面的容器框架 spring提供對持久層以及對事務的支援 spring提供mvc web框架的實現,並對一些常用的企業服務api提供一致的模型封裝 spring提供與主流框架的整合方案 2.什麼是依賴注入?什麼是控制反轉?依賴注入 元件...

積累(未完結)

1.輸出字元寬度 include include using namespace std intmain 2.精確到小數點後幾位 include include using namespace std intmain 3.不同資料型別儲存空間大小 include using namespace st...

各種排序演算法總結(未完結)

假設有n個元素,氣泡排序思想是從前往後將相鄰的兩個元素進行比較,如果前者大於後者,交換兩者位置 如果前者小於後者,則不進行任何操作。這樣一次迴圈將最大的乙個數放在最後面,下次迴圈只需對前n 1個元素進行排序,迴圈結束將第二大的數排在倒數第二,依次類推,將n個元素完成排序。氣泡排序第一次迴圈需要比較n...