I am trying to implement a 16byte input (K) in Verilog which I have never done before. Also, I need to pull each byte from the index K using a for loop. In this case, b=16bytes, w=32bits, u=w/8. Here is the for loop pseudo code I took from the RC5 encryption paper:
for i = b - 1 downto 0 do:
L[i/u]=(L[i/u]<<8)+K[i];
Here is my attempt in Verilog. I am also having trouble telling the for loop to decrease from 15 down to 0 in steps of 1.
module RC6_KeyScheduler( in, clk, out );
input byte [0:7] K[0:15] ; // Input should be 16bytes
input clk;
output reg [0:127] out;
parameter b = 16;
parameter w = 32; // word length in bits
parameter u = w/8;
parameter c = 4;
integer i;
reg [0:31] L[0: c-1];
//<statements>
always@ (*)
for (i = b-1, i>-1; i=i-1)
begin
L[i/u] = (L[i/u] << 8) + K[i];
end
endmodule
Right now I am getting errors on the way I am defining my input K and on my inequality in my for loop.
Any comments on how to fix my Verilog code to match the pseudocode would be appreciated.