Not sure if this how you have it in your mind.
Have to dive into test benches to do more with simulation. At least no risk in damaging hardware.
And thus I have not tested it in the hardware. Also getting tired, so tomorrow is a new day
But so far, again a big thanks to you BrianHG.
Cheers,
Peter
Ok, not bad... Let's examine:
if(shift_48_8_data)
begin
oreg_o_data <= long_data_reg_read[7:0]; long_data_reg_read <= { 8'h0, long_data_reg[47:8] };
end
//When enabled load the received data into the intended control register
if(load_into_control_reg) control_data_reg[ireg_i_data[1:0]] <= long_data_reg;
//When enabled read the addressed control register into the temporary register
if(read_from_control_reg)
long_data_reg_read <= control_data_reg[ireg_i_data[1:0]];
Looking what I have listed in red, you can see that there are 2 potential simultaneous times where we assign a value to 'long_data_reg_read '. Now I know this is permitted, but my personal preference would make the line a little more exclusive and to be written like this:
//When enabled read the addressed control register into the temporary register
if (read_from_control_reg) long_data_reg_read <= control_data_reg[ireg_i_data[1:0]];
else if (shift_48_8_data) long_data_reg_read <= { 8'h0, long_data_reg[47:8] };
I find this so much easier to consume mentally and we see a true order of preference.
Ok, looking at the orange, for that line, just move it to line 38 and type it like this:
always@(posedge i_main_clk) oreg_o_data <= long_data_reg_read[7:0];
This is nothing more than a simple DFF chain to the output FF, no special conditions attached.
For line 39, add:
assign io_data = ireg_i_read_write_select ? oreg_o_data : 8'bz ;
Yes, that's it. You MCU read & write interface is finished.
ireg_i_read_write_select is asynchronous, it basically is a direction control for the data bus. It does nothing else.
Now, show me your MCU read bit-blast order...