count (2)
TRANSCRIPT
7/21/2019 count (2)
http://slidepdf.com/reader/full/count-2 1/1
module counter(clk,en,rst,read,write);
input clk,rst,en;
output read,write;
always@(posedge clk)beginif(rst)count<=4'd0;else if if(en)count<=count+1'd1;else'count<=4'd0;endendmoulde
/**********************************************count********************************/module counter(clk,en,rst,read,write);
input clk,rst,en;
output read,write;
reg[1:0] count;
always@(posedge clk)beginif(rst)count<=4'd0;else if(en==1)count <= count+1'd1;else if(en==0)count <= count+1'd1;elsecount<=4'd0;
endendmodule