Skip to content

Commit 5165ff7

Browse files
author
Sebastien Bourdeauducq
committedFeb 13, 2012
Include Wishbone to ASMI bridge
1 parent 0654bf4 commit 5165ff7

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed
 

‎top.py

+31-9
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,70 @@
11
from migen.fhdl.structure import *
2-
from migen.fhdl import tools, verilog, autofragment
3-
from migen.bus import wishbone, csr, wishbone2csr
2+
from migen.fhdl import verilog, autofragment
3+
from migen.bus import wishbone, asmibus, wishbone2asmi, csr, wishbone2csr
44

55
from milkymist import m1reset, clkfx, lm32, norflash, uart, sram
66
import constraints
77

8+
MHz = 1000000
9+
clk_freq = 80*MHz
10+
sram_size = 4096 # in bytes
11+
l2_size = 8192 # in bytes
12+
813
def get():
9-
MHz = 1000000
10-
clk_freq = 80*MHz
11-
sram_size = 4096 # in bytes
12-
13-
clkfx_sys = clkfx.ClkFX(50*MHz, clk_freq)
14-
reset0 = m1reset.M1Reset()
14+
#
15+
# ASMI
16+
#
17+
asmihub0 = asmibus.Hub(24, 64, 8) # TODO: get hub from memory controller
18+
asmiport_wb = asmihub0.get_port()
19+
asmihub0.finalize()
1520

21+
#
22+
# WISHBONE
23+
#
1624
cpu0 = lm32.LM32()
1725
norflash0 = norflash.NorFlash(25, 12)
1826
sram0 = sram.SRAM(sram_size//4)
27+
wishbone2asmi0 = wishbone2asmi.WB2ASMI(l2_size//4, asmiport_wb)
1928
wishbone2csr0 = wishbone2csr.WB2CSR()
2029

2130
# norflash 0x00000000 (shadow @0x80000000)
2231
# SRAM/debug 0x10000000 (shadow @0x90000000)
2332
# USB 0x20000000 (shadow @0xa0000000)
2433
# Ethernet 0x30000000 (shadow @0xb0000000)
2534
# SDRAM 0x40000000 (shadow @0xc0000000)
26-
# CSR bridge 0x60000000 (shadow @0xe0000000)
35+
# CSR bridge 0x60000000 (shadow @0xe0000000)
2736
wishbonecon0 = wishbone.InterconnectShared(
2837
[
2938
cpu0.ibus,
3039
cpu0.dbus
3140
], [
3241
(binc("000"), norflash0.bus),
3342
(binc("001"), sram0.bus),
43+
(binc("10"), wishbone2asmi0.wishbone),
3444
(binc("11"), wishbone2csr0.wishbone)
3545
],
3646
register=True,
3747
offset=1)
3848

49+
#
50+
# CSR
51+
#
3952
uart0 = uart.UART(0, clk_freq, baud=115200)
4053
csrcon0 = csr.Interconnect(wishbone2csr0.csr, [uart0.bank.interface])
4154

55+
#
56+
# Interrupts
57+
#
4258
interrupts = Fragment([
4359
cpu0.interrupt[0].eq(uart0.events.irq)
4460
])
4561

62+
#
63+
# Housekeeping
64+
#
65+
clkfx_sys = clkfx.ClkFX(50*MHz, clk_freq)
66+
reset0 = m1reset.M1Reset()
67+
4668
frag = autofragment.from_local() + interrupts
4769
src_verilog, vns = verilog.convert(frag,
4870
{clkfx_sys.clkin, reset0.trigger_reset},

0 commit comments

Comments
 (0)