1.实验目的:用verilog实现有并行载入端的递减计数器和递增/递减计数器的仿真测试
2.实验原理:按照书上的内容,书写和运行代码,完成联合仿真实验.
- 实验代码:
(1)module downcount(R,Clock,E,L,Q);
parameter n = 8;
input [n-1:0] R;
input Clock, L, E;
output reg [n-1:0] Q;
always @(posedge Clock)
if(L)
Q<=R;
else if(E)
Q<=Q-1;
endmodule
(2)module updowncount(R, Clock, L, E, up_down, Q);
parametern =8;
input [n-1:0] R;
input Clock, L, E,up_down;
output reg [n-1:0] Q;
always @(posedge Clock)
if(L)
Q<=R;
else if (E)
Q<=Q+(up_down ? 1:-1);
endmodule
4.实验截图:
实验一:
(1)
(2)
(3)
(4)
实验二:
(1)
(2)
(3)
(4)
5.实验结果:
实验一:
实验二:
6.实验视频:
https://b23.tv/pYi11c?share_medium=android&share_source=qq&bbid=XYFFE58FF96F321BBFF65CFB7DAED93FD47E2&ts=1625073999983
7.编写博客
8.结束