[SOLVED] 4 bits serial in/parel out register in verilog

Status
Not open for further replies.

nick_20

Newbie level 3
Joined
Mar 27, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,297
hey!! can someone provide me with the behavioral description code of a 4-bit shift register with a serial input and and parel output in verilog
i am looking for something like this**broken link removed**
 

hi

parameter shift = <shift_length>;
reg [shift-1:0] <reg_name>;
always @(posedge <clock>)
<reg_name> <= {<input>, <reg_name>[shift-1:1]};
assign <output> = <reg_name>;
 
hi

parameter shift = <shift_length>;
reg [shift-1:0] <reg_name>;
always @(posedge <clock>)
<reg_name> <= {<input>, <reg_name>[shift-1:1]};
assign <output> = <reg_name>;



can you elaborate a bit more cause i am dummy????:lol:
 
Last edited:

another example better:

module shift_register (Clk, Clear, SerialIn, ParallelOut);
input Clk, SerialIn, Clear;
output [3:0] ParallelOut;
reg [3:0] tmp; <-- your four flip-flops

always @(posedge Clk)
begin
if (Clear)
tmp <= 4'b0000;
else
tmp <= {tmp[2:0], SI}; <-- concatenation , 1 cycle : you have 1101, 2 cycle : 101+serial in data 2 cycle, 3 cycle : 01+serial in data 2 cycle + serial in data 3 cycle and so on.
end

assign ParallelOut = tmp;

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