how to shift mutiple bytes in an array in one clock cycle?

Mar 21, 2007 1 Replies

i have a byte array of size 10 and i need to shift values in the array to left by 5 positions in 5 clocks. here is the code im using.



reg [7:0] data[0:9];



// data shifting process reg ps_shift_start; reg ps_done;



reg [1:0] ps_state; parameter ps_s0 = 2'b00; parameter ps_s1 = 2'b01;



reg [12:0] ps_shift; integer ps_index;



always @ (posedge clk) begin if(reset == 1) begin ps_done


How about abstracting the address instead? Each time you have to shift, the addresses 0-4 swap back and forth with 5-9. Better yet, use two arrays and swap which you read or write depending on the "shift" status.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required