How can i finalise this? any other suggestions?
I need a solution that is good for synthesis so the clock cant be used in the combinational logic part
Thank you
Added after 11 minutes:
this is the way i was going to do it which is functionally fine but is a disaster for synthesis:
What type chip are you using, and what is the clock frequency? It's probably better to double the clock frequency and do everything on the clock's rising edge. Or maybe use DDR flops, if your chip provides them.
I would like to draw your attention on select signal. You must set it in a predictable state at start-up, else you will not be able to distinguish data from address.
I mean, you should use reset signal:
Code:
always @ (posedge clk) begin
if (reset) select <=0;
else select <= ~select;
mult_addr_data <= select ? addr : data;
end
joc_06, your guidelines don't allow expressions in clocked assignments? How sad! I wonder what is the rationale of such rules?
YUV, the statement reg select = 0; does the initialization. That's the most economical way to do it in an FPGA. ASIC may not allow such initialization, however. Either way no big deal, because the final design will probably use something other than a toggle flop to generate "select".
I see. But at power up, an external device, that supplies address/data on the bus, may start working earlier than our one. So, some operations might be lost and the state of select will be really unknown.
I think, it would be better to sacrifice one pin to control address/data bus and forget this headache.
// Mux Port A address and Data onto single 8 bit bus
assign s_addr_temp = s_wena ? address : r_addr_temp;
assign s_ad = s_wena ? data : r_addr_temp;
always @ (posedge clk)
if (!reset)
r_addr_temp <= 8'b0;
else
r_addr_temp <= s_addr_temp;
here i needed to register the address so i wont lose it.
s_ad is my muxed data bus
i also send the write strobe and clock off chip
the off chip portion: ie decoder logic
Code:
// Mux Port A address and Data onto single 8 bit bus
assign s_d = s_wena ? s_ad : r_d;
assign s_a = !s_wena ? s_ad : s_a;
always @ (posedge clk)
if (!reset)
begin
r_d <= 8'b0;
end
else
begin
r_d <= s_d;
end
here i reg data so i wont lose it
s_a is my final address bus and r_d is my final data bus
thank you
what do you think of my solution?
Added after 2 minutes:
It would not be possible for me to use an initialise statement like:
reg select = 0;
this is terrible coding i feel (no offense) and would not be good for an asic or any kind of synthesis