I have a 32 bit parellel IO interface (PIO) defined in a NIOS II soft processor. It is for a 32 pin connector on a board.
I instantiate the NIOS in a top level verilog module called test
below.
On the connector pins 0:4 are JTAG pins and 5:31 are bi-directional pins that I want to be able to set direction and state.
The FT_ADB0-4 pins go to a FDTI chip for the jtag.
My question is how can I correctly write verilog for this.
I want all 32 bins on CON_0
to be available to the 32 bit PIO in the NIOS. So that when I set for example bit 10 in the PIO I am indeed controlling pin 10 on the connector.
In the code below I get the error
Error (13076): The pin "CON_0[0]" has multiple drivers due to the non-tri-state driver "FT_ADB1"
module test2 ( CLOCK_50B, CON_0, FT_ADB0, FT_ADB1, FT_ADB2, FT_ADB3, FT_ADB4);
// Basic clocks
input CLOCK_50B;
// CON_0 parallel ports
inout [31:0] CON_0;
// FT2332.. used for JTAG !
input FT_ADB0; //TCK
input FT_ADB1; //TDI
output FT_ADB2; //TDO
input FT_ADB3; //TMS
input FT_ADB4; //NRESET
assign CON_0[2] = (1) ? FT_ADB0 : 'bz; //TCK
assign CON_0[0] = (1) ? FT_ADB1 : 'bz; //TDI
assign FT_ADB2 = CON_0[1]; //TDO output from DUT drives FTDI
assign CON_0[3] = (1) ? FT_ADB3 : 'bz; //TMS
assign CON_0[4] = 'bz;
// Instantiate the Nios II system module generated by the Qsys tool:
nios2 u0 (
.clk_clk (CLOCK_50B), // clk.clk
.CON_0_export (CON_0) // CON_0.in_port
);
endmodule
(1)
). ThereforeCON_0[0] = (1) ? FT_ADB1 : 'bz
is equivalent and optimized toCON_0[0] = FT_ADB1
.nios2
is also driving this pin at the same time. At most only one should be driving at any given time, all other drivers need to be applying'bz
. \$\endgroup\$