65Org16.x Dev. Board V1.0 using a Spartan 6 XC6LX9-3TQG144
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
You don't need the ORs module at all, just get rid of that. Instead, I assume you have different modules for PS2, I2C, SPI, ROM and RAM. Each of those modules has a port with a data out bus. I assume all of those signals are named 'DO'.
What you do is declare a 'di' bus, 16 bits wide and define it as "wired OR"
I've called it 'di' because it's going to be the input for the CPU. Now, simply attach all your modules to this bus, as well as the CPU.
Each of those modules also needs a chip select signal, and it must produce all zeros on its output bus when it's not selected. If it doesn't need the upper 8 bits of the bus, it just ties them to zero permanently. The synthesis tools will automatically insert all the necessary ORs for you.
What you do is declare a 'di' bus, 16 bits wide and define it as "wired OR"
Code: Select all
wor [15:0] di;Code: Select all
ps2 ps2( .DO(di), ... );
i2c i2c( .DO(di), ... );
rom rom( .DO(di), ... );
ram ram0( .DO(di), ... );
ram ram1( .DO(di), ... );
cpu cpu( .DI(di), ... );
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
You should use '|' instead of '||' for a bitwise logical OR.
You can also write it using the entire bus at the same time.
Verilog will automatically extend the IND-INF ports will additional zero bits.
You can also write it using the entire bus at the same time.
Code: Select all
assign DO = INA | INB | INC | IND | INE | INF;
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
You can use my UART if you want.
uart.v - the UART core
uartif.v -wrapper to attach UART to CPU
The UART core was one of my very first projects I did for the Spartan-3 board, when I was just starting to learn Verilog. I still use it whenever I need a UART interface. It's very simple and basic. It only supports 8 data bits, 1 stop bit, no parity, and a fixed baud rate. It assumes a 50 MHz clock, but you can easily change the clock frequency in the code.
The UART wrapper I wrote later, when I needed a UART in a 6502 project. It uses two memory mapped registers. One for data, and the other for control/status.
uart.v - the UART core
uartif.v -wrapper to attach UART to CPU
The UART core was one of my very first projects I did for the Spartan-3 board, when I was just starting to learn Verilog. I still use it whenever I need a UART interface. It's very simple and basic. It only supports 8 data bits, 1 stop bit, no parity, and a fixed baud rate. It assumes a 50 MHz clock, but you can easily change the clock frequency in the code.
The UART wrapper I wrote later, when I needed a UART in a 6502 project. It uses two memory mapped registers. One for data, and the other for control/status.
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
ElEctric_EyE wrote:
Ok, That UART looks like it should work great just using the TX and RX, thanks again! Looking at your code, I see you have it set to go 115200baud. You had it sending data reliably without any use of CTS and RTS?
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA