Closed sporniket closed 1 year ago
address decoder : send a chip select on a unique port (a.k.a demux)
# 24 bits modes
class AddressDecoder24(Elaboratable):
def __init__(self):
self.addr = Signal(24) # plug to bus ADDR
self.frameUp = Signal(4) # ADDR[20:24]
self.frameLow = Signal(4) # ADDR[16:20]
self.framePeriph = Signal(4) # ADDR[12:16]
self.selector=Signal(xxx) # width = number of selectable subsystems
def ports(self)->List[]:
return [self.addr, self.selector]
def elaborate(self,platform):
m = Module()
m.d.comb += [
self.frameUp.eq(self.addr[20:24]),
self.frameLow.eq(self.addr[20:24]),
self.framePeriph.eq(self.addr[20:24]),
]
with m.Switch(self.frameUp):
with m.Case(0):
with m.If((addr[2:24]==0) | (addr[2:24]==1)):
m.d.sync += self.selector.eq(SELECT_ROM)
with m.Else():
m.d.sync += self.selector.eq(SELECT_RAM)
with m.Case(0xE):
m.d.sync += self.selector.eq(SELECT_ROM)
with m.Case(0xF):
# Switch case over self.frameLow, then for case 0xF switch case over self.framePeriph
# and at the end self.selector.eq(SELECT_<whatever>)
with m.Default():
m.d.sync += [
self.selector.eq(SELECT_RAM)
]
return m
Epic
Initialisation Good
As FPGA
I want to hold the CPU on reset state as long as the system is not ready
In order to prepare the system (ROM copying etc...)
Functionnal Memory mapping
24 bits mode
reference
$0
(Long)$xxx
$4
(Long)$xxx
$8
→$00CFFFFF
$xxD00000
→$xxDFFFFF
$xxE00000
→$xxEFFFFF
$xxF00000
→$xxF0003F
$xxF00040
→$xxF9FFFF
$xxFA0000
→$xxFBFFFF
$xxFC0000
→$xxFEFFFF
$xxFF0000
→$xxFFFFFF
SDRam Memory Map
For a SDRAM size on N, in MB.