dkvlsi
Newbie level 2
- Joined
- Sep 19, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 17
I have written verilog code for 4 bit Serial in serial out.
module siso(
input clk,reset,in,
output reg [3:0] out);
reg [3:0]temp;
always @ (posedge clk)
begin
if (reset)
begin
out <= 0;
temp <= 0;
end
else
begin
temp[0] <= in;
temp <= temp << 1;
out <= temp[3];
end
end
endmodule
output is coming 0000 and even in temp input is not loading. I am not understanding why its happening like this.
if i swap the statements
temp[0] <= in;
temp <= temp << 1;
as
temp <= temp << 1;
temp[0] <= in;
output is coming.
PLZ tell me why its not working with the previous structure. :idea:
Thanks in advance
module siso(
input clk,reset,in,
output reg [3:0] out);
reg [3:0]temp;
always @ (posedge clk)
begin
if (reset)
begin
out <= 0;
temp <= 0;
end
else
begin
temp[0] <= in;
temp <= temp << 1;
out <= temp[3];
end
end
endmodule
output is coming 0000 and even in temp input is not loading. I am not understanding why its happening like this.
if i swap the statements
temp[0] <= in;
temp <= temp << 1;
as
temp <= temp << 1;
temp[0] <= in;
output is coming.
PLZ tell me why its not working with the previous structure. :idea:
Thanks in advance