rogger201
Newbie level 6
I desire to implement an operation which uses shifting of data and using the MSB for output side.
One data needs to be shifted 1 bit at a time and the MSB of this shifted data needs to be used in every cycle with another input data.
I am having an issue with the fact that the MSB bit isnt changing at all. As if that bit is not getting communicated with my module that uses this bit to send to the output.
I will type the code that I am using :
It seems like the shift_data is not getting communicated with the case blocks. How can I make it work?
One data needs to be shifted 1 bit at a time and the MSB of this shifted data needs to be used in every cycle with another input data.
I am having an issue with the fact that the MSB bit isnt changing at all. As if that bit is not getting communicated with my module that uses this bit to send to the output.
I will type the code that I am using :
Code:
input [7:0] input_data;
input [7:0] send_data;
input [1:0] sel;
output reg [8:0] out;
reg [7:0] shift_data;
//shift register
always @(posedge clock) begin
if (reset) shift_data = 0;
else if (load) shift_data = input_data;
else shift_data = {1'b0, shift_data[7:1]};
end
//this is the module that makes use of this shifted data's MSB along with another input.
always@(input_data or send_data or sel)
begin
case (sel)
2'b00: out = {send_data[5:7], shift_data[0]};
.
.
.
//other cases that are irrelevant here
It seems like the shift_data is not getting communicated with the case blocks. How can I make it work?