I think I finally have my decoding down. Suggestions needed.

Building your first 6502-based project? We'll help you get started here.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

I think I finally have my decoding down. Suggestions needed.

Post by cbmeeks »

I'm working on several side projects but my main goal has always been to design my own SBC. As I work on these side projects, I learn new things...

So, I think I finally have a more sane decoding scheme that isn't crazy or hard to build. I would love everyone's input.

I'm not at my normal computer at the moment so I can't upload a true schematic but I have attached a hand-drawn version.

The basic plan is 32K RAM, 16K ROM and 6 I/O devices. I don't think I really need that many. So I could shorten the list.

Here is the memory map:

Code: Select all

Memory Map
===============================================
ROM    11_xxxxxx_xxxxxxxx    $C000-$FFFF (16KB)
I/O 0  10_000001_RRRRRRRR    $8100-$81FF
I/O 1  10_000010_RRRRRRRR    $8200-$82FF
I/O 2  10_000100_RRRRRRRR    $8400-$84FF
I/O 3  10_001000_RRRRRRRR    $8800-$88FF
I/O 4  10_010000_RRRRRRRR    $9000-$90FF
I/O 5  10_100000_RRRRRRRR    $A000-$A0FF
RAM    0x_xxxxxx_xxxxxxxx    $0000-$7FFF (32KB)
I like the idea of full page I/O because I plan on using a micro-controller as one of them and I need the 256 bytes for it.

Here is my *CRUDE* schematic:
SCH_01.JPG
So I'm thinking I would need 3 quad-input NAND gates for the decoding logic. One would be for RAM, ROM and one I/O. And another would be for four I/O. I could ditch the third one and "settle" for 5 I/O devices.

What do you guys think?

I haven't spec'd the part yet. But I have a few 74HC132's around. Top speed for the computer would be 1-2MHz.

Do you think the setup would work with an even faster clock? Say 4-8 MHz? I imagine I would have to use faster NAND gates.

Thanks!
Cat; the other white meat.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by GARTHWILSON »

Going into the NAND gates for the I/O select, you don't need to repeat it for every I/O IC. You can use the same one. What you do need to do though is invert the A14 before it goes into the NAND. However, what you have is pretty close to what's in the 2nd-to-last schematic of the address-decoding page of the 6502 primer.
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?
User avatar
Michael
Posts: 633
Joined: 13 Feb 2013
Location: Michigan, USA

Re: I think I finally have my decoding down. Suggestions nee

Post by Michael »

Would there be any advantage using ɸ2 qualified /RD and /WR signals instead of a ɸ2 qualified RAM select signal? You would use the A15 address line for the active-low RAM select ($0000..$7FFF). Also, if you think you might use an EEPROM and you'd like the capability to program it in-circuit, I think EEPROMs require mutually exclusive /RD and /WR signals, don't they? Please correct me if I'm wrong, guys.

I wouldn't mind trying this simple decoder scheme using the CLC (configurable logic cell) modules on a little 14-pin or 20-pin PIC.
decoder pic.png
Last edited by Michael on Sat Feb 20, 2016 7:18 am, edited 1 time in total.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbmeeks »

GARTHWILSON wrote:
Going into the NAND gates for the I/O select, you don't need to repeat it for every I/O IC. You can use the same one. What you do need to do though is invert the A14 before it goes into the NAND. However, what you have is pretty close to what's in the 2nd-to-last schematic of the address-decoding page of the 6502 primer.
AH yeah! That's much better. lol

I don't know what I was thinking. Anyway, I certainly can't take credit as I got the idea from the primer site. :-D

So I should be able to use only one NAND chip right? Even for all 6 I/O's? Plus I think I can invert A14 using VCC and one of the NAND inputs.

I'll draw up another schematic soon.
Cat; the other white meat.
User avatar
cbscpe
Posts: 491
Joined: 13 Oct 2013
Location: Switzerland
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbscpe »

I would also recommend the idea of Micheal to have a master read and write signal that is connected to the OE and WE signal of ROM / RAM. These signals are also useful for non 65xx peripherals like the UARTs often proposed by BDD. This takes 3 NAND gates. As Micheal said the best is to use A15 as the chip select for the RAM. THen you use the forth NAND gate with its inputs cnnected to A14 and A15 for the chip select of the ROM. Then I would propose to add a 74ACT138 as the IO address decoder. A15 would be connected to active high enable and A14 would be conncted to one of the active low enable inputs. The second active low enable input is connected to GND. Then you connect A13, A12 and A11 to the inputs A,B and C of the 74ACT138. With this you get 8 IO ranges. So with only two descrete TTL logic chip you have a complete address decoder. Note that 65xx peripherals can share one of the IO select lines using the activ hgh chip select to distinguish the individual chip using some of the unused addresss lines, in this case A10 to A4.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbmeeks »

Michael wrote:
I wouldn't mind trying this using the CLC (configurable logic cell) modules on a little 14-pin or 20-pin PIC.
I'm not familiar with CLC in PIC's. Is that some type of low-level CPLD/FGPA functionality? That would be pretty awesome if it were.
cbscpe wrote:
I would also recommend the idea of Micheal to have a master read and write signal that is connected to the OE and WE signal of ROM / RAM. .......... As Micheal said the best is to use A15 as the chip select for the RAM.
cbscpe wrote:
Then you connect A13, A12 and A11 to the inputs A,B and C of the 74ACT138. With this you get 8 IO ranges. ......Note that 65xx peripherals can share one of the IO select lines using the activ hgh chip select to distinguish the individual chip using some of the unused addresss lines, in this case A10 to A4.
So the basic principal is that using the 1 of 8 decoder, I get 8 different IO devices using A[13:11]. But I'm not sure I understand what you mean about the 65XX sharing IO lines. I'm thinking 8 IO devices is plenty (up from my original 6). Or, do you mean something else?

cbscpe wrote:
Then I would propose to add a 74ACT138 as the IO address decoder
That chip looks pretty awesome (10.9ns propagation delay) but it doesn't appear to run at 3v3. I guess for that kind of speed you need 5v. Hmm. I could run everything 5v except my mcu. I planned on having 5v available anyway.

cbscpe wrote:
So with only two descrete TTL logic chip you have a complete address decoder
Which is exactly why I wanted to consult the experts. Not only did I learn something, now my chip count is reduced by two.
Cat; the other white meat.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by BigDumbDinosaur »

In regards to using the 74ACT138 as a general purpose decoder, there is no good reason to use 74ACT logic unless it is being driven by 74LS logic, or by devices that generate TTL-compatible outputs. Almost all 74ACT devices are slower than their 74AC equivalents, and are theoretically more noise-sensitive. This also applies to 74HC vs. 74HCT logic. While the speed of any one device may not be critical, the prop delays through a series of devices can quickly add up. So this should be a consideration in your design.

In general, if all devices (MPU, I/O hardware, RAM, etc.) in your system are CMOS then all logic should be CMOS, which means no 74ACT or 74HCT should be used at all. I generally recommend 74AC if the Ø2 clock will exceed 8 MHz.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by BigDumbDinosaur »

cbscpe wrote:
I would also recommend the idea of Micheal to have a master read and write signal that is connected to the OE and WE signal of ROM / RAM. These signals are also useful for non 65xx peripherals like the UARTs often proposed by BDD.
Here is the circuit I devised for POC V1.
Read/Write Generation
Read/Write Generation
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
cbscpe
Posts: 491
Joined: 13 Oct 2013
Location: Switzerland
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbscpe »

BDD is right, use the 74AC138. First it is more compatible with the output levels of the W65C02 (although this is no issue in this case) but more important the AC devices are specified for a voltage range of 2.0 to 6.0 volts. Of course running your system at 3v3 limits its max speed to approx 8MHz.
User avatar
Michael
Posts: 633
Joined: 13 Feb 2013
Location: Michigan, USA

Re: I think I finally have my decoding down. Suggestions nee

Post by Michael »

A couple single chip solutions come to mind;
decoder 1.png
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbmeeks »

Thanks for the suggestions!

I didn't know that about AC vs. ACT.

I added some 74AC138 & 74AC139's to my Mouser shopping cart. I think all I have at home are LS versions.

Concerning 3v3 and maximum speed, my target speed for my first computer is going to be in the 1-2MHz range with 4MHz being "high speed". :-)

SBC#2 or 3 will probably be an '816 running in the 8-10 MHz range. So I have some time.
Cat; the other white meat.
User avatar
cbscpe
Posts: 491
Joined: 13 Oct 2013
Location: Switzerland
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbscpe »

Hi Micheal, I would rather not use the '139 to create the PHI2 qualified signals as the '139 is rather slow compared to a 74AC00 and due to the very short data hold time provided by the W65C02 and the required data hold time of normal speed RAM (55ns or slower) this could violate the guaranteed times for writes.

cbmeeks, if your goal for the clock range is in this range you could use the clock from the UART. 4MHz with this minimalistic decoder with short delays and without using buffers for the data bus is definitively going to work. My simple systems, using only one 10ns GAL for all the glue, run at 11MHz even when built on a breadboard. Of course at 5V and using a fast (20ns) RAM.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbmeeks »

cbscpe wrote:
My simple systems, using only one 10ns GAL for all the glue, run at 11MHz even when built on a breadboard. Of course at 5V and using a fast (20ns) RAM.
I'd really like to get into that. I've done a little FPGA but FPGA is extreme overkill for this (not to mention hard to design boards).

I mean, 2-3 small logic IC's isn't the end of the world. But a small, through-hole GAL would be nice. However, everyone seems to recommend small CPLD's for anything NOT FPGA. Heck, many people say CPLD's aren't worth it. Which I don't get.
Cat; the other white meat.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by BigDumbDinosaur »

cbmeeks wrote:
However, everyone seems to recommend small CPLD's for anything NOT FPGA. Heck, many people say CPLD's aren't worth it. Which I don't get.
CPLDs have the advantage of being able to consolidate many logic functions into a single device, with a guaranteed pin-to-pin propagation time that will simplify timing calculations. GALs offer guaranteed pin-to-pin prop times as well, but being SPLDs, are limited in total logic functions, inputs and outputs. Even a small CPLD (e.g., an Atmel ATF1504AS) has considerably more logic resources, as well as many more uncommitted I/O pins (32 on an ATF1504AS). In my opinion, a small CPLD makes more sense with what most of us are trying to achieve.

That said, you can build a pretty decent system using only discrete logic. My POC V1 unit uses only 74AC and 74ABT logic in DIP packages, has 52KB of available RAM, 8KB of ROM, a 2KB I/O block (RTC, DUART and SCSI), and runs at 12.5 MHz, which is the maximum speed at which the I/O is stable (there is no wait-stating). RAM, ROM and I/O select logic is such that no more than two gate delays are present in any given circuit. I am certain that if it weren't for the limitations of the I/O hardware I could run the unit at 20 MHz.
Last edited by BigDumbDinosaur on Sat Feb 20, 2016 2:37 am, edited 1 time in total.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: I think I finally have my decoding down. Suggestions nee

Post by cbmeeks »

I'm going to order some AC series logic. But I'm assuming LS would be fine for 1-2 MHz systems?
Cat; the other white meat.
Post Reply