1 from migen
.fhdl
.structure
import *
2 from migen
.fhdl
import convtools
, verilog
, autofragment
3 from migen
.bus
import wishbone
, csr
, wishbone2csr
5 from milkymist
import m1reset
, clkfx
, lm32
, norflash
, uart
12 clkfx_sys
= clkfx
.Inst(50*MHz
, clk_freq
)
13 reset0
= m1reset
.Inst()
16 norflash0
= norflash
.Inst(25, 12)
17 wishbone2csr0
= wishbone2csr
.Inst()
18 wishbonecon0
= wishbone
.InterconnectShared(
19 [cpu0
.ibus
, cpu0
.dbus
],
20 [(0, norflash0
.bus
), (3, wishbone2csr0
.wishbone
)],
23 uart0
= uart
.Inst(0, clk_freq
, baud
=115200)
24 csrcon0
= csr
.Interconnect(wishbone2csr0
.csr
, [uart0
.bank
.interface
])
26 frag
= autofragment
.from_local()
27 vns
= convtools
.Namespace()
28 src_verilog
= verilog
.convert(frag
,
29 {clkfx_sys
.clkin
, reset0
.trigger_reset
},
31 clk_signal
=clkfx_sys
.clkout
,
32 rst_signal
=reset0
.sys_rst
,
34 src_ucf
= constraints
.get(vns
, clkfx_sys
, reset0
, norflash0
, uart0
)
35 return (src_verilog
, src_ucf
)