6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Sep 19, 2024 4:02 am

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Sep 12, 2021 8:39 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 374
Very basic question (I think). As a side-project, I am just trying to wire up my first, basic 65c816 SBC. When reading the datasheet, I noticed that Write Data becomes valid some time after the positive edge of PHI2, and Read Data becomes valid thereafter, when PHI2 goes low again. This is different timing than the 65c02 (clearly). So, assuming that I will be using both Native and Emulation modes, what is the proper logic to use for the RAM /OE and /CE? For my 65c02 projects, for example, I would use A15 as /OE and I would use A15 inverted (through an 'AC00 or 'HC00 NAND) NAND'ed with PHI2, so that /CE only goes low when PHI2 is high and A15 is low (putting the first 32K from $0 through $7FFF, in this hypothetical)).

So, how in the world does one properly set up /OE, /CE, and /RW for, say, a bank of 32K of ram (70ns or 55ns, for example) - just as an example?

Thanks in advance for any input you may have!

Jon


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 12, 2021 9:00 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
I'm going to step back from the specifics of what you say here, and suggest you study Jeff's explanation of the bus timing. Why do I suggest that? Because you've followed your chain of reasoning and concluded that things can't work - so, it must be that your chain of reasoning went wrong somewhere, and you are the one best placed to debug it.

See here:
https://laughtonelectronics.com/Arcana/ ... iming.html


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 12, 2021 9:02 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 374
BigEd wrote:
I'm going to step back from the specifics of what you say here, and suggest you study Jeff's explanation of the bus timing. Why do I suggest that? Because you've followed your chain of reasoning and concluded that things can't work - so, it must be that your chain of reasoning went wrong somewhere, and you are the one best placed to debug it.

See here:
https://laughtonelectronics.com/Arcana/ ... iming.html

My guess here, as to data read and write in this example, would be to NAND A15 with inverted PHI2 to read and write data when A15 and clock are low. Is this right?

Jon


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 12, 2021 10:19 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Jmstein7 wrote:
Write Data becomes valid some time after the positive edge of PHI2, and Read Data becomes valid thereafter, when PHI2 goes low again.
I hope it's clear that, in terms of timing, the datasheet describes what the CPU does but it also describes what the CPU requires -- IOW, what the attached circuitry (memory and IO) must do. Perhaps there's no misunderstanding, but for clarity l would rephrase the second part of your statement to say, Read Data is required to be made valid thereafter, just before PHI2 goes low again. IOW, the CPU doesn't make read data valid; it's the device being read which does that. And it must do so in a way that meets CPU timing requirements.

65(c)02 bus timing is substantially same as '816 bus timing. That applies to how A15 - A0 change in the first half of the cycle, and also the activity on the data bus during Phi-2 high -- the read data and write data. So, one doesn't need to re-learn that stuff. The big contrast is the data bus during Phi-2 low. An '02 or 'C02 always "floats" (tri-states) the data bus during Phi-low, whereas the '816 always outputs the Bank Address during Phi-low. This is true even in Emulation Mode (although in Emulation Mode the Bank Address defaults to zero).

Quote:
So, how in the world does one properly set up /OE, /CE, and /RW for, say, a bank of 32K of ram
Generally speaking, with '816 your main concern is to ensure that no memory or IO device drives the data bus during Phi-2 low. But otherwise you can pretty much treat the '816 as you would an '02 or 'C02. Note: the '816 will be noisier, so good construction techniques and supply bypass caps become more important.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Sun Sep 12, 2021 10:39 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 12, 2021 10:34 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8383
Location: Midwestern USA
Attachment:
File comment: Read/Write Generation for 65C816
read_write_qualify_alt.gif
read_write_qualify_alt.gif [ 46.98 KiB | Viewed 3034 times ]

Nothing to it. :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 12, 2021 10:43 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 374
BigDumbDinosaur wrote:
Attachment:
read_write_qualify_alt.gif

Nothing to it. :D

Lol :D

But, what wires connect to /OE and /CE (or /CS) on the chip? I.e., what wires get connected to Output Enable, Chip Enable, and, I guess, /RW?

Moreover, must I use a 74AC74 (or the like) with the oscillator? I have a max rise/fall of 8ns, and it works fine with my ‘C02s.

Also, do I need to tie “abort” high if I’m not going to use it? I’m trying to figure the differences on the pin out from the ‘C02.

Jon


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 12, 2021 10:49 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
There's more than one "right answer," so how about you post your proposed schematic and we'll comment. :)

No, you probably don't need the 74AC74. Almost anything that was OK for a 'C02 will be OK for the '816 -- except, as noted above: you need to ensure that no memory or IO device drives the data bus during Phi-2 low.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 12, 2021 11:50 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 374
Okay, but I can’t propose anything until I have some idea as to what I’m to connect to /OE, /CE, and /RW. That is still unclear. Once I have that piece, I can draw-out the rest. J


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 13, 2021 12:27 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
Jmstein7 wrote:
Okay, but I can’t propose anything until I have some idea as to what I’m to connect to /OE, /CE, and /RW. That is still unclear. Once I have that piece, I can draw-out the rest. J


So, typical SRAM chips have /OE (which is Output Enable), /CE (which is Chip Enable) and /WE (which is Write Enable). There is no /RW in general, but the 65XX CPUs have a R/W, which is single line which is High when in Read and Low when in Write mode. BDD has given you the classic schematic for generating qualified /Read and /Write signals from the single R/W and Ph2 clock lines.

So, /OE is reading from memory, /WE is writing to memory and /CE is selecting the memory chip.

/RD gets tied to /OE
/WD gets tied to /WE
your address decoding select output gets tied to /CE

Hopefully this helps...

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 13, 2021 12:40 am 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 374
Kevin,

You’re right - I realized I changed nomenclature. I did mean /WE. I guess I’m just used to using those three connections with the ‘C02 in completely different ways. I never actually considered the signals’ literal meanings.

Jon


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 13, 2021 1:38 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Alright, here's a bare-bones schematic, based on the discussion above.

I've added a '245 transceiver, which is optional in this case but still recommended. Because the '245 is only enabled during Phi-2 high, it satisfies the requirement I mentioned earlier about no external devices driving the 816's data bus during the Phi-2 low time. That requirement is also satisfied in this case by the "glue" -- notably the way /OE on the RAM never goes low except during Phi2 low, so in that sense the '245 is redundant, but it earns its keep in other ways, making for a more forgiving and easy to get working system (especially when ROM and I/O are considered).

-- Jeff
Attachment:
basic 816 glue_.png
basic 816 glue_.png [ 5.06 KiB | Viewed 2998 times ]

Edit to the diagram: remove inverter between A15 and /CE,

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Mon Sep 13, 2021 2:16 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 13, 2021 2:01 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8383
Location: Midwestern USA
Jmstein7 wrote:
But, what wires connect to /OE and /CE (or /CS) on the chip? I.e., what wires get connected to Output Enable, Chip Enable, and, I guess, /RW?

Sorry for the earlier terse post. My wife called me to dinner right as I was posting and around here, a juicy chuck roast with corn-on-the-cob has priority over computers. :D

Kevin explained what /RD and /WD in the read/write generator do, so I don't need to add anymore to that. The illustrated circuit is what I have used in my POC units up through V1.3. Using it with your SRAM and ROM will assure that those devices don't attempt to drive the data bus during Ø2 low when the 65C816 is emitting the bank bits.

Also, Ed pointed you to Jeff's timing tutorial, which can go a long way in shedding light on how clock performance can affect overall system performance.

Regarding the use of a flip-flop to condition the clock oscillator's output, its need is strongly tied to the clock rate you plan to run. As Jeff's timing tutorial demonstrates, clock symmetry (or lack thereof) becomes important as you close in on the MPU's maximum rating (officially 14 MHz, but take that with a grain or two of salt—recent production 816s are capable of at least 20 MHz).

The duty cycle for most can oscillators is usually in the range 47:53 to 53:47, with the ideal, of course, being 50:50. If your oscillator is running at 10 MHz and is 50:50, then each clock phase's duration will be 50ns. If your oscillator is a "worst-case" unit, one phase's duration will be 47ns and the other's will be 53ns. Any WDC MPU will easily tolerate that variance, and I wouldn't expect that any other clock-dependent device in your system will have a problem with it as well.

Now, suppose you're running at 14 MHz. The clock period is approximately 71.4ns, and an ideal oscillator's phases will have a 35.7ns duration. That is within spec for the 65C816. On the other hand, if your oscillator is 47:53, the low phase will be shortened to 31.7ns, which is out of spec for the 816. While the more recent 816s with TSMC 0.6µ geometry dice will tolerate that, the older Sanyo dice fabricated to 0.8µ geometry might not. So it would become a judgment call as to whether to run the oscillator's output through a flop.

One thing use of a flop does for you is provide two out-of-phase clock signals, which I call Ø1 and Ø2. Ø2 would be used to drive the 816's PHI2 input, as well as the same inputs on other 65ss devices, e.g., a 65C22. Ø1 is useful for controlling the bank bits latch—required if you wish to address more than 64KB of RAM, as well as gating a data bus transceiver. An alternative if you don't use a flop in your clock generator is to run Ø2 through an inverter to generate Ø1. In this case, Ø1 will lag Ø2 by the amount of propagation delay in the inverter.

Dr Jefyll wrote:
Alright, here's a bare-bones schematic, based on the discussion above.

I see Jeff sneaked in while I was posting. :D Note that in his circuit the 'B' pins of the transceiver must "face" the MPU. The transceiver will help with bus contention, as well as efface some of the effects of bus capacitance. Plus if you use a 74xCT type transceiver, it will act as a level converter, accommodating typical SRAMs, which have TTL-level outputs.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 13, 2021 2:05 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8383
Location: Midwestern USA
Dr Jefyll wrote:
Alright, here's a bare-bones schematic, based on the discussion above...

I'm a little confused. If SRAM is to be selected in the range of $0000-$7FFF, there wouldn't be a need for the inverter connected to the RAM's /CE input, correct?

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 13, 2021 2:13 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
You're not confused -- I am. Distracted posting. My bad. I'll fix it. :oops:

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 13, 2021 5:22 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8383
Location: Midwestern USA
Dr Jefyll wrote:
You're not confused -- I am. Distracted posting. My bad. I'll fix it. :oops:

Use my excuse. :D I'm an old fuddy-duddy.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: