Altera_Forum
Honored Contributor
13 years agoCreating a bidirectional bus
I want to connect a USB chip (FT245R) to a CPLD. To do that I need a bidirectional 8-bit bus. I thought I could declare the pins to be bidirectional and with a mux, read to or write from the pins as necessary. My Verilog code for the mux is:
[code]
always @(negedge clk) begin: TESTUSB_MUX
if ((TXE == 0)) begin
USBBUS <= OUTBUS;
end
else if ((RXF == 0)) begin
INBUS <= USBBUS;
end
end
[\code]
But the Fitter generates errors, e.g., Error: Can't reserve pin "USBBUS[0]" because its name already exists with a different direction
How can a bidirectional bus be created?