count (2)

2
 module counter(clk,en,rst,read,write); input clk,rst,en; output read,write; always@(posedge clk) begin if(rst) count<=4'd0; else if  if(en) count<=count+1'd1; else'count<=4'd0; end endmoulde /**********************************************count**************************** ****/ module counter(clk,en,rst,read,write); input clk,rst,en; output read,write; reg[1:0] count; always@(posedge clk) begin if(rst) count<=4'd0; else if(en==1) count <= count+1'd1; else if(en==0) count <= count+1'd1; else count<=4'd0; end endmodule

Upload: navneeth-gnl

Post on 04-Feb-2018

217 views

Category:

Documents


0 download

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