4-bit shift register using behavioral modelling

Status
Not open for further replies.

pavani40444

Newbie level 2
Joined
Apr 4, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,290
pls send me verilog code for 4-bit shift register using behavioral modelling
 

Please send your attempt first, and people will fix it.
 

Anyway lets help:

module shiftReg ( out, in, clk, reset);
input in;
input clk;
input reset;

output out;

reg [0:3] mem;

assign out = mem [3];

always @ (posedge clk)
begin
if (reset)
mem <= 4'b0;
else
mem <= {in,mem};
end

endmodule

Folks feel free to add comments.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…