I created a shift register to transfer bits from my spartan 3e to another spartan 3e. I'm using the following code to shift.
- Code: Select all
- module TX_Shifting(Clk, Data_in, Data_out, enable, Reset);
 input Clk,enable,Reset;
 input [7:0] Data_in;
 output Data_out;
 reg [7:0] tmp;
 reg [7:0] counter;
 initial counter = 0;
 initial tmp = 0;
 
 always @(posedge Clk)
 begin
 if (Reset)
 begin
 tmp=0;
 counter=0;
 end
 if (enable)
 begin
 tmp = tmp << 1;
 tmp[0] = Data_in[7-counter]; //sends MSB first
 counter = counter +1;
 if (counter>8) counter=0;
 end
 end
 
 assign Data_out = tmp[7];
 endmodule
My question is regarding shift registers. If I changed the shift from <<1 to <<2 will the output of my module miss every other bit because it inserts two zeros prior to updating my output variable? Or does it work differently. Also, a question about the recieving board. Should I recieve all 8 bits from Master module prior to updating the config on the Slave board? Or do you think it's fine to just update on the fly.
Any advice on trying to tranfer data is welcome.
 
 
Thank you,
Daniel

