掃描二維碼
隨時隨地手機看文章
module CMBLOP (o, a, b, c);output o;input a, b, c;reg o;wire m = a | o;wire n = b | m;always @(c or n)o = c | n;endmodule在一般的數(shù)字設(shè)計中不用使用組合邏輯環(huán),需要在其中進行插拍(異步設(shè)計除外)。?仿真競爭冒險:在兩個或兩個以上變量之間沒有電路邏輯環(huán),但有一個仿真反饋路徑。module SIMLOP;wire a, c;reg b;always @ (a or c) beginb = a;endassign c = b;endmodulemodule wr_wr_race (clk, a, b); //Write – Write Raceinput clk,b;output a;wire d1, d2;reg c1, c2, a; always @(posedge clk) c1 = b;always @(posedge clk) c2 = ~b;assign d1 = c1;assign d2 = c2;always @(d1) a = d1;always @(d2) a = d2; endmoduleWrite-Write競爭冒險可以通過將寫入操作合并成單個進程來解決。?Read - Write Contention Racealways @(posedge clk) /* write process */status_reg = new_val;always @(posedge clk) /* read process */status_output = status_reg;上述讀寫競爭冒險可以通過non-blocking賦值解決。?避免競爭冒險的幾個建議:1.使用non blocking賦值。2.一個寄存器只在單個語句塊中賦值。3.assign賦值語句僅用來連接,不用來產(chǎn)生邏輯。