curious_mind
Full Member level 4
I understand how to implement shift register (serial in parallel out) in verilog on data bits. But I would like to implement it on a word data. Could anybody guide me?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
reg [0:15] register[0:8]; //2D array
integer i;
always@(posedge SYSCLK)
begin
if(RESET==0)
begin
register[0] <= 16'd0;
register[1] <= 16'd0;
register[2] <= 16'd0;
register[3] <= 16'd0;
register[4] <= 16'd0;
register[5] <= 16'd0;
register[6] <= 16'd0;
register[7] <= 16'd0;
register[8] <= 16'd0;
end
else if (ADC_DATA_RDY==1)
begin
for(i = 8; i > 0; i=i-1) begin
register <= register[i-1];
end
register[0] <= DATAIN;
end
end
if (ADC_DATA_RDY==1)
begin
for(i = 8; i > 0; i=i-1) begin
register <= register[i-1];
end
register[0] <= DATAIN;
end
end
Not exactly. The OP implemented a (syntactically correct) synchronous reset, possibly unintentionally. This is also the reason for the different look in RTL viewer.For starters, You’re missing RESET in your sensitivity list.
always@(negedge RESET or posedge SYSCLK)