当前位置:网站首页>Always of SystemVerilog usage_ comb 、always_ iff
Always of SystemVerilog usage_ comb 、always_ iff
2022-07-06 14:21:00 【Then the dish】
always_comb
always_comb Each internal statement is a blocking assignment statement . Circuit statements... Cannot appear (assign)
always_comb It has the following properties :
Internal coverage
External atomicity
always_comb begin
a = 1'b1;
b = a;
a =1'b0;
c = a;
end
// Circuit input :1'b1;1'b0; // On the right (1'b1;1'b0; a) Remove the left side (a,b,c)
// Circuit output :(a,b,c)// On the left
// Running results a=1'b0, b=1'b1, c=1'b0,
assign a = b;
always_comb begin
b = 1'b1;
c = a;
b = 1'b0;
end
// First always_comb have to : c = a, b = 1'b0; Again assign have to :a = b = 1'b0; c = a = 1'b0
// therefore a=1'b0, b=1'b0, c=1'b0,
assign a = b;
always_comb begin
b = 1'b1;
c = b;
b = 1'b0;
end
// First always_comb have to : c = b = 1'b1; b = 1'b0 Again assign have to :a = b = 1'b0;
// therefore a=1'b0, b=1'b0, c=1'b1,
always_comb case
unique case
case There is no priority in the block , Parallel comparison .
// unique case
always_comb begin
b = 1'b0;
unique case (a[3:0])
4'd1: begin b = 1'b1; end
4'd0: begin b = 1'b0; end
default: begin end
endcase
end
priority case
case There is priority in the block , Serial comparison ( Compare in turn )
always_comb begin
priority case (1'b1)
a[3]: begin end
a[2]: begin end
default: begin end
endcase
end
// amount to :
/*
always_comb begin
if(a[3]) begin
end else if(a[2]) begin
end else if() begin end
end
*/
always_comb if and for
if
if and else Used for conditional judgment
always_comb begin
b = 1'b0;
if (a[3]) begin b = 1'b1; end
else if (a[2]) begin b = 1'b0; end
else begin end
end
for
for stay always_comb in , Will be interpreted as loop expansion .
logic [15:0]a;
logic [3:0] b;
always_comb begin
b = '0;
for (int i = 15; i >= 0; i--) begin
if (a[i]) begin
b = i[3:0];
break;
end
end
end
always_comb begin
for (int i = 0 ; i < 16; i ++) begin
if (i >= n) break;
end
end
always_comb begin
for (int i = 0; i < 16; i++) begin
a[i] = b[i] & (c[i] == d[i] | e[i]); // The compiler doesn't think i Is constant ,a[i:i+3] illegal
end
end
for (genvar i = 0; i < 16; i++) begin // genvar assign
assign a[i] = b[i] & (c[i] == d[i] | e[i]); // The compiler thinks i Is constant ,a[i:i+3] legal
always_comb begin
end
end
always_ff
always_ff Used to describe triggers .
always_ff @(posedge clk) begin
if (~resetn) begin
q <= '0; // Trigger non blocking assignment
end else if (en) begin
q <= d;
end
end
logic [3:0] a, a_nxt;
// always_ff Write only the trigger part Nonblocking assignment
always_ff @(posedge clk) begin
if (~resetn) begin
a <= '0;
end else if (en) begin
{a, b} <= {a_nxt, b_nxt};
end
end
always_comb begin
a_nxt = a;
// Logic that does not belong to a trigger , Written in always_comb Block assignment
unique case(a)
4'd3: begin
a_nxt = 4'd2;
end
default: begin
end
endcase
end
Thank you for sharing !!
(4 Bar message ) System Verilog grammar _ Record on pit -CSDN Blog
边栏推荐
- Hackmyvm target series (6) -videoclub
- 循环队列(C语言)
- MSF generate payload Encyclopedia
- Experiment 7 use of common classes (correction post)
- 强化學習基礎記錄
- 7-3 construction hash table (PTA program design)
- The United States has repeatedly revealed that the yield of interest rate hiked treasury bonds continued to rise
- Sqqyw (indifferent dot icon system) vulnerability recurrence and 74cms vulnerability recurrence
- The difference between layer 3 switch and router
- 强化学习基础记录
猜你喜欢

《英特尔 oneAPI—打开异构新纪元》

7-5 staircase upgrade (PTA program design)

链队实现(C语言)

. How to upload XMIND files to Jinshan document sharing online editing?

Intranet information collection of Intranet penetration (4)

Xray and Burp linked Mining

Hackmyvm target series (3) -visions

中间件漏洞复现—apache

Low income from doing we media? 90% of people make mistakes in these three points

SRC mining ideas and methods
随机推荐
实验四 数组
攻防世界MISC练习区(gif 掀桌子 ext3 )
captcha-killer验证码识别插件
What language should I learn from zero foundation. Suggestions
[insert, modify and delete data in the headsong educator data table]
Attack and defense world misc practice area (GIF lift table ext3)
[data processing of numpy and pytoch]
An unhandled exception occurred when C connected to SQL Server: system Argumentexception: "keyword not supported:" integrated
HackMyvm靶机系列(1)-webmaster
Renforcer les dossiers de base de l'apprentissage
HackMyvm靶機系列(3)-visions
Hackmyvm target series (2) -warrior
[paper reproduction] cyclegan (based on pytorch framework) {unfinished}
Internet Management (Information Collection)
链队实现(C语言)
"Gold, silver and four" job hopping needs to be cautious. Can an article solve the interview?
2022华中杯数学建模思路
Sqqyw (indifferent dot icon system) vulnerability recurrence and 74cms vulnerability recurrence
A complete collection of papers on text recognition
Library management system