Verilog code to interface an FPGA with a real WDC65C816S?
Re: Verilog code to interface an FPGA with a real WDC65C816S
beholdnec, if you post a photo of your layout then that might be revealing. Indeed, there might be opportunities for significant improvements without much effort. (BTW on this forum you're allowed to attach images with your posts.)
cheers,
Jeff
cheers,
Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Verilog code to interface an FPGA with a real WDC65C816S
Quote:
390.625GHz? Er...390.625kHz. 
I suppose I might as well show off the project. Attached is a photo. Please don't laugh.
As I've mentioned, the FPGA is able to detect the FFFC,FFFD bootup sequence and run a program made of all NOP's (0xEA). Attached is a capture of the A0 line when running NOP's (it should toggle every cycle). The result looks... more like a sawblade than a digital signal. The "0" part is -0.1 to 0.3 V. The "1" part is 2.59 to 3.20 V. At a 3.3V power supply, this is barely within tolerances. Something should probably be done to improve it.
It might be important to note that the Pynq-Z1 board has 200-ohm safety resistors on almost all of its digital I/O pins. There are 6 pins available without resistors, but I don't want to use those pins unless I absolutely have to.
Re: Verilog code to interface an FPGA with a real WDC65C816S
Oh oh - I cannot find any capacitor on your breadboard !?
This is very necessary : place a 100 nF (0.1 µF) capacitor (ceramic or film) between Vdd (pin 8 ) and GND. The cap's pin should be next to pin 8 then the (shortest available) wire to Vdd. There another 0.1µF should sit directly between Vdd and GND. I would add another one (this time 10µ tantalum or ceramic) where you power the breadboard (black & white wires).
Second: provide a shorter (additional) wire between GND (pin 21) and GND - best a wire to the other pin of that C that is next to pin 8.
This is very necessary : place a 100 nF (0.1 µF) capacitor (ceramic or film) between Vdd (pin 8 ) and GND. The cap's pin should be next to pin 8 then the (shortest available) wire to Vdd. There another 0.1µF should sit directly between Vdd and GND. I would add another one (this time 10µ tantalum or ceramic) where you power the breadboard (black & white wires).
Second: provide a shorter (additional) wire between GND (pin 21) and GND - best a wire to the other pin of that C that is next to pin 8.
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Verilog code to interface an FPGA with a real WDC65C816S
Yes, and this is where I was saying there should be a capacitor straddling the IC itself, with the shortest possible connection from the VDD pin to the Vss pin. Connection length adds inductance, something you definitely don't want here. Capacitor leads will have about 18 nanoHenries of inductance per inch of length.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Verilog code to interface an FPGA with a real WDC65C816S
GARTHWILSON wrote:
there should be a capacitor straddling the IC itself, with the shortest possible connection from the VDD pin to the Vss pin
beholdnec wrote:
Attached is a capture of the A0 line when runnin.g NOP's (it should toggle every cycle).
cheers
Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Verilog code to interface an FPGA with a real WDC65C816S
Thank you all for the advice! Why, yes, I am a bit of a novice... I knew it was good to have caps near a chip but I didn't have any on hand, and I guessed that it wasn't terribly important.
Now I have caps on my board, and the signal is much cleaner.
Unfortunately the data lines seem to be transmitting late. That is, the FPGA thinks it sends the bytes 00, 06 when the 65816 requests the reset address FFFC,FFFD, however, the 65816 then starts executing from address 00000a9 and FPGA reads nonsensical data from the 65816. I suspect this is a timing issue, where the signals fail to meet setup and hold times. Attached is a trace from the FPGA.
Now I have caps on my board, and the signal is much cleaner.
Unfortunately the data lines seem to be transmitting late. That is, the FPGA thinks it sends the bytes 00, 06 when the 65816 requests the reset address FFFC,FFFD, however, the 65816 then starts executing from address 00000a9 and FPGA reads nonsensical data from the 65816. I suspect this is a timing issue, where the signals fail to meet setup and hold times. Attached is a trace from the FPGA.
Re: Verilog code to interface an FPGA with a real WDC65C816S
On the LA trace I see rows of data for wdc_bus_1_0_d_out_captured and wdc_bus_1_0_d_in_captured. I don't know what the difference is supposed to be. But around the 2,500 mark is where the '816 has finished getting the 2-byte reset address from FFFC, FFFD, and we know on the next cycle it will use what it got as the address from which to start fetching code.
Looking at the address on next cycle, we see it is $00A9, which is consistent with the preceding cycles on wdc_bus_1_0_d_in_captured. But to me your remark seems to imply you expected wdc_bus_1_0_d_out_captured (which would've pointed to $0600) to be relevant instead. There seems to be some confusion somewhere.
Looking at the address on next cycle, we see it is $00A9, which is consistent with the preceding cycles on wdc_bus_1_0_d_in_captured. But to me your remark seems to imply you expected wdc_bus_1_0_d_out_captured (which would've pointed to $0600) to be relevant instead. There seems to be some confusion somewhere.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Verilog code to interface an FPGA with a real WDC65C816S
Yes, there was tremendous confusion on my part. I currently launch memory accesses on the falling edge of PHI2, after capturing the bank address and A. The read value is presented in the next cycle while PHI2 is high.
IIUC, what's actually supposed to happen is the memory read completes in the CURRENT cycle and the result value is presented before the falling edge.
I made too many assumptions about what the datasheet was trying to say.
IIUC, what's actually supposed to happen is the memory read completes in the CURRENT cycle and the result value is presented before the falling edge.
I made too many assumptions about what the datasheet was trying to say.
Re: Verilog code to interface an FPGA with a real WDC65C816S
beholdnec wrote:
the memory read completes in the CURRENT cycle
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Verilog code to interface an FPGA with a real WDC65C816S
Synchronous memory is also the norm within an FPGA, which might lead someone with a strong FPGA background into difficult territory.
Re: Verilog code to interface an FPGA with a real WDC65C816S
Perhaps this timing diagram of a simulated asynchronous 6502/65C02 interface using a synchronous 4 cycle FPGA implementation may help. It does not address the 65816 extended address cycles, but it does describe the state machine required to implement the asynchronous 6502/65C02 memory interface in a synchronous manner.
Michael A.
-
SpaceCoaster
- Posts: 33
- Joined: 11 Apr 2019
Re: Verilog code to interface an FPGA with a real WDC65C816S
Awesome! What did you do to fix it?
Re: Verilog code to interface an FPGA with a real WDC65C816S
SpaceCoaster wrote:
Awesome! What did you do to fix it?
I'd have something cool to show, but I'm currently held up trying to implement a video transmitter on the FPGA. Never do this if you value your sanity.
-
SpaceCoaster
- Posts: 33
- Joined: 11 Apr 2019