# generate add.il ilang file with: python3 add.py
#
-from nmigen import Elaboratable, Signal, Module
+from nmigen import Elaboratable, Signal, Module, Const, DomainRenamer
from nmigen.cli import verilog
# to get c4m-jtag
# set up JTAG
self.jtag = TAP(ir_width=4)
- self.jtag.bus.tck.name = 'tck'
- self.jtag.bus.tms.name = 'tms'
- self.jtag.bus.tdo.name = 'tdo'
- self.jtag.bus.tdi.name = 'tdi'
+ self.jtag.bus.tck.name = 'jtag_tck'
+ self.jtag.bus.tms.name = 'jtag_tms'
+ self.jtag.bus.tdo.name = 'jtag_tdo'
+ self.jtag.bus.tdi.name = 'jtag_tdi'
# have to create at least one shift register
self.sr = self.jtag.add_shiftreg(ircode=4, length=3)
# do a simple "add"
m.d.sync += self.f.eq(self.a + self.b)
+ m.d.sync += self.f[0].eq(Const(0, 1))
return m
-def create_ilang(dut, ports, test_name):
+def create_verilog(dut, ports, test_name):
vl = verilog.convert(dut, name=test_name, ports=ports)
with open("%s.v" % test_name, "w") as f:
f.write(vl)
if __name__ == "__main__":
- alu = ADD(width=4)
- create_ilang(alu, [alu.a, alu.b, alu.f,
+ alu = DomainRenamer("sys")(ADD(width=4))
+ create_verilog(alu, [alu.a, alu.b, alu.f,
alu.jtag.bus.tck,
alu.jtag.bus.tms,
alu.jtag.bus.tdo,
, (IoPin.SOUTH, None, 'power_0' , 'vdd' )
, (IoPin.SOUTH, None, 'p_a2' , 'a(2)' , 'a(2)' )
, (IoPin.SOUTH, None, 'p_b3' , 'b(3)' , 'b(3)' )
- , (IoPin.EAST , None, 'p_tms_0' , 'tms' , 'tms' )
- , (IoPin.EAST , None, 'p_tdo_0' , 'tdo' , 'tdo' )
+ , (IoPin.EAST , None, 'p_tms_0' , 'jtag_tms' , 'jtag_tms' )
+ , (IoPin.EAST , None, 'p_tdo_0' , 'jtag_tdo' , 'jtag_tdo' )
, (IoPin.EAST , None, 'ground_0' , 'vss' )
- , (IoPin.EAST , None, 'p_clk' , 'clk' , 'clk' )
- , (IoPin.EAST , None, 'p_tck' , 'tck' , 'tck' )
- , (IoPin.EAST , None, 'p_tdi_0' , 'tdi' , 'tdi' )
+ , (IoPin.EAST , None, 'p_sys_clk' , 'sys_clk' , 'sys_clk' )
+ , (IoPin.EAST , None, 'p_tck' , 'jtag_tck' , 'jtag_tck' )
+ , (IoPin.EAST , None, 'p_tdi_0' , 'jtag_tdi' , 'jtag_tdi' )
, (IoPin.EAST , None, 'p_b2' , 'b(2)' , 'b(2)' )
, (IoPin.NORTH, None, 'ioground_0' , 'iovss' )
, (IoPin.NORTH, None, 'p_b1' , 'b(1)' , 'b(1)' )
, (IoPin.NORTH, None, 'ground_1' , 'vss' )
, (IoPin.NORTH, None, 'p_b0' , 'b(0)' , 'b(0)' )
- , (IoPin.NORTH, None, 'rst' , 'rst' , 'rst' )
+ , (IoPin.NORTH, None, 'sys_rst' , 'sys_rst' , 'sys_rst' )
, (IoPin.WEST , None, 'p_f3' , 'f(3)' , 'f(3)' )
, (IoPin.WEST , None, 'p_f2' , 'f(2)' , 'f(2)' )
, (IoPin.WEST , None, 'power_1' , 'vdd' )