连云港企业建站 网站,国内永久免费crm游戏,郑州网站优化工资,中国搜索引擎市场份额比较不同计数器的运算方式#xff0c;其中有一个数是延迟打一拍的效果#xff0c;目的是使得两个计数器的结果相同。 1#xff0c;第一种2#xff0c;第二种3#xff0c;第三种 第三种方案#xff0c;完成实现。 1#xff0c;第一种
#xff08;1#xff09;RTL modu… 比较不同计数器的运算方式其中有一个数是延迟打一拍的效果目的是使得两个计数器的结果相同。 1第一种2第二种3第三种 第三种方案完成实现。 1第一种
1RTL module c(
input clk,
input rst_n,
// input a,
// input b,
output cnt1,
output cnt2
);reg [4:0] cnt1, cnt2;
always(posedge clk or negedge rst_n) beginif(!rst_n) begincnt1 0;cnt2 0;endelse if(cnt1 16) begincnt1 cnt1 1;cnt2 cnt1; endelse begincnt1 0;cnt2 0;end
endendmodule
2TB module tb_c;
reg clk;
reg rst_n;
wire [4:0] cnt1;
wire [4:0] cnt2;always #10 clk ~clk;initial beginclk 1; rst_n 1;#20; rst_n 0;#40; rst_n 1; end c uu(
.clk(clk),
.rst_n(rst_n),
.cnt1(cnt1),
.cnt2(cnt2)
);endmodule
3仿真
2第二种
1RTL module c(
input clk,
input rst_n,
// input a,
// input b,
output cnt1,
output cnt2
);reg [4:0] cnt1, cnt2;
always(posedge clk or negedge rst_n) beginif(!rst_n) begincnt1 0;cnt2 0;endelse if(cnt2 16) begincnt1 cnt1 1;cnt2 cnt1; endelse begincnt1 0;cnt2 0;end
endendmodule
2TB module tb_c;
reg clk;
reg rst_n;
wire [4:0] cnt1;
wire [4:0] cnt2;always #10 clk ~clk;initial beginclk 1; rst_n 1;#20; rst_n 0;#40; rst_n 1; end c uu(
.clk(clk),
.rst_n(rst_n),
.cnt1(cnt1),
.cnt2(cnt2)
);endmodule
3仿真
3第三种
1RTL module c(
input clk,
input rst_n,
// input a,
// input b,
output cnt1,
output cnt2
);reg [4:0] cnt1, cnt2;
// 1
always(posedge clk or negedge rst_n) beginif(!rst_n) begincnt1 0;endelse if(cnt1 16) begincnt1 cnt1 1; // 1endelse begincnt1 0;end
end// 2
always(posedge clk or negedge rst_n) beginif(!rst_n) begincnt2 0;endelse if(cnt2 16) begincnt2 cnt1; // 0endelse begincnt2 0;end
endendmodule
2TB
module tb_c;
reg clk;
reg rst_n;
wire [4:0] cnt1;
wire [4:0] cnt2;always #10 clk ~clk;initial beginclk 1; rst_n 1;#20; rst_n 0;#40; rst_n 1; end c uu(
.clk(clk),
.rst_n(rst_n),
.cnt1(cnt1),
.cnt2(cnt2)
);endmodule
3仿真