Splitting the address space

Building your first 6502-based project? We'll help you get started here.
yvibod
Posts: 11
Joined: 11 Mar 2015

Splitting the address space

Post by yvibod »

Hello, on my first 6502 project i have to divide the address space between 3 RAM chips, 3 ROM chips and a VIA. I know how this works, but i was just wondering if there is any tool available or formula of some kind to help me do this the most efficient way possible? I plan on using some 3 to 8 memory decoders.
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Splitting the address space

Post by barrym95838 »

yvibod wrote:
Hello, on my first 6502 project i have to divide the address space between 3 RAM chips, 3 ROM chips and a VIA. I know how this works, but i was just wondering if there is any tool available or formula of some kind to help me do this the most efficient way possible? I plan on using some 3 to 8 memory decoders.
Have you checked Garth's very nice page on address decoding, to see if he has something suitable for your proposed configuration?

http://wilsonminesco.com/6502primer/addr_decoding.html

Mike B.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Splitting the address space

Post by BigDumbDinosaur »

yvibod wrote:
Hello, on my first 6502 project i have to divide the address space between 3 RAM chips, 3 ROM chips and a VIA. I know how this works, but i was just wondering if there is any tool available or formula of some kind to help me do this the most efficient way possible? I plan on using some 3 to 8 memory decoders.
Perhaps if you could post your proposed memory map we may be able to offer some suggestions.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Splitting the address space

Post by BigEd »

Welcome, yvibod! With a single 3 to 8 decoder you can split the 64k address space into 8 sections of 8k each. You have 7 devices to fit in, so if all the devices are 8k or smaller, you're already finished!

As BDD notes, more information is needed to solve the problem. But to answer your question, I don't know of any tool or formula: understanding what's happening and knowing what you want to do leads relatively directly to a solution: you are splitting or merging blocks of memory which have a power-of-two size. An efficient design will not decode any more finely than necessary: having a single VIA mapped over an entire 16k is a viable solution for some cases. For other cases, you'd want to map the VIA all the way down to a 16-address window. And there are many intermediate cases.

I second Mike's recommendation to read Garth's primer.

Cheers
Ed
yvibod
Posts: 11
Joined: 11 Mar 2015

Re: Splitting the address space

Post by yvibod »

Thank you for the suggestions, the chips are 3 RAMs of 3K each at the beginning of address space, 3 ROMs of 3K each at the end and a VIA at the beginning of the second 32K bank. Before I made the question I was looking for at tool that would do this sort of work but now I tried doing it by hand it isn't that hard really.
yvibod
Posts: 11
Joined: 11 Mar 2015

Re: Splitting the address space

Post by yvibod »

BigEd wrote:
Welcome, yvibod! With a single 3 to 8 decoder you can split the 64k address space into 8 sections of 8k each. You have 7 devices to fit in, so if all the devices are 8k or smaller, you're already finished!

As BDD notes, more information is needed to solve the problem. But to answer your question, I don't know of any tool or formula: understanding what's happening and knowing what you want to do leads relatively directly to a solution: you are splitting or merging blocks of memory which have a power-of-two size. An efficient design will not decode any more finely than necessary: having a single VIA mapped over an entire 16k is a viable solution for some cases. For other cases, you'd want to map the VIA all the way down to a 16-address window. And there are many intermediate cases.

I second Mike's recommendation to read Garth's primer.

Cheers
Ed
Each memory chip is 2K, if i put them in 8k blocks there would be a gap between them right? Would that be a problem?
I was trying to organize it in a way that all the ram would form a single 6k block.
rwiker
Posts: 294
Joined: 03 Mar 2011

Re: Splitting the address space

Post by rwiker »

yvibod wrote:
BigEd wrote:
Welcome, yvibod! With a single 3 to 8 decoder you can split the 64k address space into 8 sections of 8k each. You have 7 devices to fit in, so if all the devices are 8k or smaller, you're already finished!

As BDD notes, more information is needed to solve the problem. But to answer your question, I don't know of any tool or formula: understanding what's happening and knowing what you want to do leads relatively directly to a solution: you are splitting or merging blocks of memory which have a power-of-two size. An efficient design will not decode any more finely than necessary: having a single VIA mapped over an entire 16k is a viable solution for some cases. For other cases, you'd want to map the VIA all the way down to a 16-address window. And there are many intermediate cases.

I second Mike's recommendation to read Garth's primer.

Cheers
Ed
Each memory chip is 2K, if i put them in 8k blocks there would be a gap between them right? Would that be a problem?
I was trying to organize it in a way that all the ram would form a single 6k block.
In that case, you may want to use an 7-way decoder to split the memory into 8k blocks, and a 4-way decoder to split a particular 8k block into 4 2k blocks. This may not be ideal in terms of propagation delays, but it used to be fairly common.

The 74LS138 is an example of an 8-way decoder, while the 74LS139 has two 4-way decoders in a single package. Note: depending on what technology your other components use, you will probably want to use a different chip family than 74LS.
yvibod
Posts: 11
Joined: 11 Mar 2015

Re: Splitting the address space

Post by yvibod »

rwiker wrote:
yvibod wrote:
BigEd wrote:
Welcome, yvibod! With a single 3 to 8 decoder you can split the 64k address space into 8 sections of 8k each. You have 7 devices to fit in, so if all the devices are 8k or smaller, you're already finished!

As BDD notes, more information is needed to solve the problem. But to answer your question, I don't know of any tool or formula: understanding what's happening and knowing what you want to do leads relatively directly to a solution: you are splitting or merging blocks of memory which have a power-of-two size. An efficient design will not decode any more finely than necessary: having a single VIA mapped over an entire 16k is a viable solution for some cases. For other cases, you'd want to map the VIA all the way down to a 16-address window. And there are many intermediate cases.

I second Mike's recommendation to read Garth's primer.

Cheers
Ed
Each memory chip is 2K, if i put them in 8k blocks there would be a gap between them right? Would that be a problem?
I was trying to organize it in a way that all the ram would form a single 6k block.
In that case, you may want to use an 7-way decoder to split the memory into 8k blocks, and a 4-way decoder to split a particular 8k block into 4 2k blocks. This may not be ideal in terms of propagation delays, but it used to be fairly common.

The 74LS138 is an example of an 8-way decoder, while the 74LS139 has two 4-way decoders in a single package. Note: depending on what technology your other components use, you will probably want to use a different chip family than 74LS.
I dont think propagation will be much of a problem, since i'm only working at 1Mhz. Thanks for the recommendation on the decoders, I don't have those chips but they should be easy enough to get.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Splitting the address space

Post by BigEd »

3k RAM seems a really unusual size to me - what part are you using?
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Splitting the address space

Post by GARTHWILSON »

You'll want the RAM contiguous so programs don't don't have to jump over dead or mirrored spaces, and so you can have contiguous data arrays. Why not just spend a few dollars on a 32Kx8 SRAM? It will pay for itself in the reduced number of sockets required, the labor to wire-wrap it all, and in board space.
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?
yvibod
Posts: 11
Joined: 11 Mar 2015

Re: Splitting the address space

Post by yvibod »

GARTHWILSON wrote:
You'll want the RAM contiguous so programs don't don't have to jump over dead or mirrored spaces, and so you can have contiguous data arrays. Why not just spend a few dollars on a 32Kx8 SRAM? It will pay for itself in the reduced number of sockets required, the labor to wire-wrap it all, and in board space.
I'd love to, but i live in South America and it's a real pain to buy some components, so i'll have to use what i have.
yvibod
Posts: 11
Joined: 11 Mar 2015

Re: Splitting the address space

Post by yvibod »

BigEd wrote:
3k RAM seems a really unusual size to me - what part are you using?
Sorry, it's actually 2K. It's a HM6116P for RAM and a XLS28C16BP for ROM
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Splitting the address space

Post by BigEd »

Ah, that's more like it! So, indeed, having decoded down to 8k blocks, you need to decode two more address bits to get to a 2k size. There is such a thing as a 2-to-4 decoder, or you could use some NAND or NOR gates probably.
Edit: or indeed use another 3 to 8 decoder, if that's what you have, and tie off an input.
yvibod
Posts: 11
Joined: 11 Mar 2015

Re: Splitting the address space

Post by yvibod »

BigEd wrote:
Ah, that's more like it! So, indeed, having decoded down to 8k blocks, you need to decode two more address bits to get to a 2k size. There is such a thing as a 2-to-4 decoder, or you could use some NAND or NOR gates probably.
Edit: or indeed use another 3 to 8 decoder, if that's what you have, and tie off an input.
Just got back from the store with some 74LS139! They are cheap so i got some on my way home. So I'll connect the 3-8's inputs to the top three address lines, A15 A14 and A13 to divide the address space into 8K blocks, when I reach the block I need, say the first for the RAM, the equivalent 3-8 output will hit the enable line of the 2-4. The 2-4 will be connected to A14 and A13? since 8k in binary is 10000000000000?
Not sure about that last part.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Splitting the address space

Post by BigEd »

You need to decode A12 and A11 to decide which 2k block is active.
Post Reply