CHOCHI - an inexpensive FPGA board with 128K SRAM

Topics relating to PALs, CPLDs, FPGAs, and other PLDs used for the support or creation of 65-family processors, both hardware and HDL.
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by Arlet »

enso wrote:
Looking at the SRAM128K.v module I noticed the 'OE = 0' line... That is probably not a good thing - it should really not be enabled during writing. I can't remember if the datasheet implied that it doesn't matter as the output goes hi-z.
That's not a problem. WE takes priority.
Quote:
Arlet, regarding your final scope screendump - what is the horizontal unit? How often are the transients occuring?
Horizontal unit is shown in the display -- 100 ns/division.
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by enso »

I have to run out and my brain is not really working, but...

At 45MHz each clock is 220ns; the pulses are coming at weird intervals, no?
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by Arlet »

enso wrote:
At 45MHz each clock is 220ns; the pulses are coming at weird intervals, no?
1000/45 = 22.22 ns. Looks like it is high for about 1 clock period, and then discharges through the pull down resistor.
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by enso »

Yes, I meant 22, not 220. Can you tell how often the pulses come in terms 6502 cycles?

Here is the bootloader loop:

Code: Select all

;--------------------------------------------------------------
; Poll serial port for input.  Flash the led while doing so...
poll1:         dec 0                    ;low digit 0
               bne   getbyte
poll2:         dec 1                    ;digit 1
               bne   getbyte
poll3:         dec 2                    ;if we get here, counted 64K
               lda   2                  ;get digit 2
               lsr   a                  ;and use bit 2 as flasher
               lsr   a
               lsr   a
               sta   $C000
getbyte:       lda   UART_STATUS       ;Serial port status
               and   #$40              ;mask data present bit
               beq   poll1             ;no char to get
               lda   UART_DATA         ;get chr
               rts                     ;

Most of the time the CPU sits in the poll1 loop. I am curious which instruction causes the spike since it's so regular...

I have to fix the bootloader to not use high memory variables. That prevents it from overloading the top of page $FF.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by enso »

Arlet, when you get a chance, could you put the clock on the second channel of your scope?

The clock is connected to a pin on the connector. I am away from my workspace, but I am pretty sure it's the third pin from the left on the bottom row of the connector. I'll double-check when I get a chance.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
User avatar
MichaelM
Posts: 761
Joined: 23 Apr 2012
Location: Huntsville, AL

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by MichaelM »

enso:

I've attached an SRAM Interface module that uses the technique for generating the SRAM control strobes that I described yesterday: ODDR2 registers to generate SRAM chip enable, output enable, and write enable. I've included a synthesizable memory tester in the attached ZIP, in addition to a self-checking functional test bench.

The functional test bench and the synthesizable memory tester have been run to verify the ChoChi_SRAM_IF.v module which I've attached. I was unable to get a DDR2 tri-state control register to join with the IOB OFD used for the the output data register, so I've had to resort to using a 2x clock to enable the data bus drivers (from FPGA to SRAM) only during the period while the data bus is being driven.

The SRAM address and SRAM write data are captured in IOB OFDs on the falling edge of the system clock. This approach minimizes data path skews from the core to the SRAM. I looked at the source for Arlet's core that you provided, and it clearly multiplexes in an asynchronous manner the address bus (AB) and the output data bus (DO). An asynchronous multiplexer can also be found for the the we output.

In your SRAM interface module, you only register the data from the SRAM. The attached SRAM interface module registers the data on the way out and on the way in. The issue will be whether or not the combinatorial path delays in the AB and DO multiplexer signal paths are less than half of the clock period. If so, then the attached SRAM IF will provide deskewed address and data outputs, and retain the single cycle behavior that you would like to have.

I have not yet attached the connectors to the CHOCHI board which you sent me, so I built the SRAM Interface Test module for my M65C02 FPGA test board. (For a few minutes last night, I was frantically turning the office and house upside down trying to locate the CHOCHI board so I could check the speed of the part. I finally found it on the kitchen counter in its shipping container. :oops: ) I ran the interface tester on one of my SRAMs, on which I've been running a simple test program for the past few weeks.

Both the CHOCHI SRAM and my SRAMs are 10ns asynchronous devices. I have a 14.7456 MHz oscillator as the reference oscillator, and I use a DCM for internal clock and reset generation. (I've also attached the clock and reset generator module that I used for testing.) I had to run the clock frequency to above 66 MHz before I was able to get the tester function to detect an error. The synthesizable memory tester is performing a walking 1s and walking 0s (16 patterns) test on each memory location in my 32kB SRAM. (I only tested one of the two SRAMs on my board.) I was only able to get an error in the memory pattern when I operated at 66+ MHz and I put both scope leads on the same data line.

If I get a chance later this week, I will try building your CHOCHI code and running it on that card. I may also try and get your code running on my little board. I may also try getting your SRAM128K module to operate with the synthesizable memory tester. The synchronous nature of the test pattern generator will not be a good analog of the AB and DO multiplexer signal paths in your 6502 code. But it will provide an independent assessment of your memory interface, and perhaps help pinpoint the source of the glitches being observed.

Hope the attached code is of some use to you.
SRAM_IF.zip
Synchronous interface for asynchronous SRAMs.
(14.14 KiB) Downloaded 169 times
Michael A.
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by enso »

Michael, I am extremely grateful. I will look at your code when ASAP and will can't wait to see what your investigation reveals. Let me know if you need anything at all.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by enso »

Something to keep in mind - the XC3S50 is the faster speed grade 5
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by Arlet »

I'll try to find some time later to measure this. But you can also run a sim, and see if you get the same pulses.

But keep in mind that with combinatorial outputs you can have glitches even if you're not using SRAM. Basically, you can have random data on all your SRAM signals except in the (very small) setup/hold interval around a clock.
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by enso »

Arlet, the other educational thing to try is to hook your board up and see if it exhibits the same kind of glitches in a dead loop.

As I mentioned before (and you seem to agree) my guess is that we are looking at the normal operation of the core, and there is nothing to be alarmed about.

Registering the control signals would probably incur an extra cycle delay, so there we are.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by Arlet »

If you add a register on the output signals, but remove the register on the input, the cycle count stays the same, but you don't risk writing to the RAM.
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by enso »

cc65 support files are now available. I just posted the files in the 'Programming' topic viewtopic.php?f=2&t=2728and the CHOCHI website http://apple2.x10.mx/CHOCHI/.

The zipfile includes everything necessary (other than cc65 itself) to start compiling C code, including an example that blinks an LED.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
jazz
Posts: 7
Joined: 11 Apr 2017
Location: UK

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by jazz »

is this still active/available?
I got a bounce from enso's email address on his web page.
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: CHOCHI - an inexpensive FPGA board with 128K SRAM

Post by BigDumbDinosaur »

jazz wrote:
is this still active/available?
I got a bounce from enso's email address on his web page.
Good question. Enso hasn't visited the forum since June last year.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Post Reply