用Verilog设计一个8位二进制加法计数器,带异步复位端口,进行综合和仿真。
module BinaryCounter8Bit(
input wire clk,
input wire rst,
output wire [7:0] count
);
reg [7:0] count;
always @(posedge clk or negedge rst) begin
if (!rst) begin
count <= 8'b0;
end else begin
count <= count + 1;
end
end
assign count = count;
endmodule
点此处编译
综合
仿真
这里还需将rst置1才有效
- 可以在clk=0;后加rst=1;
- 或者在clk=0;后加rst=0;
并且在#DELY clk=~clk;后加#(DELY*20) rst=~rst;
仿真即可