标签:
无标签
同学问我一道O2的笔试题,
module C_case1(clk,out1);
input clk;
output out1;
reg state1;
reg out1;
always @(posedge clk)
case(state1)
0: state1<=1;
1: state1<=0;
endcase
always @(state1)
case(state1)
0: out1<=1;
1: out1<=0;
endcase
endmodule
module C_case2(clk,out2);
input clk;
output out2;
reg state2;
reg out2;
always @(posedge clk)
case(state2)
0:begin
state2<=1;
out2<=1;
end
1:begin
state2<=0;
out2<=0;
end
endcase
endmodule
两者资源比较。
在Quartus综合结果如下:
第一种:

组合Case
第二种:

时序Case
明显第一种比第二种省个触发器
工程文件打包如下:

系统分类:
CPLD/FPGA | 用户分类:
Verilog | 来源:
原创 | 【推荐给朋友】 | 【添加到收藏夹】