Hi!
czuhars wrote:
Hi all,
I’m working a project that is based on an existing TTL logic-based design, where a 6502 shares a data bus with a 6522 and a ROM chip. It then shares this bus with external peripherals with an old DM8304 bidirectional buffer acting as gatekeeper which is controlled by other logic.
I’m trying to incorporate the same setup, but connecting a FPGA on this shared bus, mainly for its onboard SDRAM. The FPGA handles the glue logic throughout the system, including the signal to let the data pass between it and the shared bus.
But I’m not getting stellar results. Rather, when this “dm8304 enable” signal is active on the ‘02’s write, I’m only getting 8’bZ on my FPGA’s i/o.
In my FPGA, I’m doing a bidirectional bus this way (in Verilog):
inout wire [7:0] data;
assign data = (r_w) ? data_to_cpu : 8’bZ;
assign data_from_cpu = data;
I’ve also tried using the FPGA’s primitives to handle the bidirectional transactions.
My question is, should it be ok for my FPGA to be hooked directly to this external shared bus, and acting internally as the 8304 (or74245) and passing the data through in a tri-state manner? Or is it better practice to use an actual bidirectional buffer chip between this data bus and my FPGA’s GPIO, which the FPGA can control?
For this setup, my external chips are a WDC 65c02 and a WDC 65c22, operating at 3.3v, the same as the FPGA (iCESugar-Pro (Lattice ECP5)).
Thanks!
PS: I’ve tried creating a bin file through both Lattice Diamond and the Yosys/nextpnr/ecppack tool chain with similar results.
You don't use bidirectional signals in a FPGA, as those are not supported in the internal fabric. You use two separate busses, one for input and one for output. And then, you use bidirectional I/O pins in the FPGA, that should have control signals for enabling/disabling the output buffer.
You should read your FPGA manual on how to instantiate the bidirectional I/O. According to the manual at
https://www.latticesemi.com/-/media/Lat ... t_id=50464 , you need to instantiate a "BB" component, the example in page 23 is:
Code:
BB buf7 (.I(Q_out7), .T(Q_tri7), .O(buf_Data7), .B(Data[7]));
There, 'T' is the "tri-state' input, 'I' the input from the FPGA to the pin, 'O' the output to the FPGA from the pin, and 'B' is the actual FPGA pin.
Have Fun!