1 """simple core issuer verilog generator
5 from nmigen
.cli
import verilog
7 from openpower
.consts
import MSR
8 from soc
.config
.test
.test_loadstore
import TestMemPspec
9 from soc
.simple
.issuer
import TestIssuer
12 if __name__
== '__main__':
13 parser
= argparse
.ArgumentParser(description
="Simple core issuer " \
15 parser
.add_argument("output_filename")
16 parser
.add_argument("--enable-xics", dest
='xics', action
="store_true",
17 help="Enable interrupts",
19 parser
.add_argument("--disable-xics", dest
='xics', action
="store_false",
20 help="Disable interrupts",
22 parser
.add_argument("--enable-lessports", dest
='lessports',
24 help="Enable less regfile ports",
26 parser
.add_argument("--disable-lessports", dest
='lessports',
28 help="enable more regfile ports",
30 parser
.add_argument("--enable-core", dest
='core', action
="store_true",
31 help="Enable main core",
33 parser
.add_argument("--disable-core", dest
='core', action
="store_false",
34 help="disable main core",
36 parser
.add_argument("--enable-mmu", dest
='mmu', action
="store_true",
39 parser
.add_argument("--disable-mmu", dest
='mmu', action
="store_false",
42 parser
.add_argument("--enable-pll", dest
='pll', action
="store_true",
45 parser
.add_argument("--disable-pll", dest
='pll', action
="store_false",
48 parser
.add_argument("--enable-testgpio", action
="store_true",
49 help="Disable gpio pins",
51 parser
.add_argument("--enable-sram4x4kblock", action
="store_true",
52 help="Disable sram 4x4k block",
54 parser
.add_argument("--debug", default
="jtag", help="Select debug " \
55 "interface [jtag | dmi] [default jtag]")
56 parser
.add_argument("--enable-svp64", dest
='svp64', action
="store_true",
59 parser
.add_argument("--disable-svp64", dest
='svp64', action
="store_false",
63 args
= parser
.parse_args()
68 'cr': 1, 'branch': 1, 'trap': 1,
76 units
['mmu'] = 1 # enable MMU
78 # decide which memory type to configure
80 ldst_ifacetype
= 'mmu_cache_wb'
81 imem_ifacetype
= 'mmu_cache_wb'
83 ldst_ifacetype
= 'bare_wb'
84 imem_ifacetype
= 'bare_wb'
86 # default MSR (TODO, provide option to set default PC as well)
87 msr_reset
= (1<<MSR
.LE
) |
(1<<MSR
.SF
) # 64-bit, little-endian default
89 pspec
= TestMemPspec(ldst_ifacetype
=ldst_ifacetype
,
90 imem_ifacetype
=imem_ifacetype
,
95 # set to 32 for instruction-memory width=32
97 # set to 32 to make data wishbone bus 32-bit
99 xics
=args
.xics
, # XICS interrupt controller
100 nocore
=not args
.core
, # test coriolis2 ioring
101 regreduce
= args
.lessports
, # less regfile ports
102 use_pll
=args
.pll
, # bypass PLL
103 gpio
=args
.enable_testgpio
, # for test purposes
104 sram4x4kblock
=args
.enable_sram4x4kblock
, # add SRAMs
105 debug
=args
.debug
, # set to jtag or dmi
106 svp64
=args
.svp64
, # enable SVP64
107 microwatt_mmu
=args
.mmu
, # enable MMU
111 print("mmu", pspec
.__dict
__["microwatt_mmu"])
112 print("nocore", pspec
.__dict
__["nocore"])
113 print("regreduce", pspec
.__dict
__["regreduce"])
114 print("gpio", pspec
.__dict
__["gpio"])
115 print("sram4x4kblock", pspec
.__dict
__["sram4x4kblock"])
116 print("xics", pspec
.__dict
__["xics"])
117 print("use_pll", pspec
.__dict
__["use_pll"])
118 print("debug", pspec
.__dict
__["debug"])
119 print("SVP64", pspec
.__dict
__["svp64"])
121 dut
= TestIssuer(pspec
)
123 vl
= verilog
.convert(dut
, ports
=dut
.external_ports(), name
="test_issuer")
124 with
open(args
.output_filename
, "w") as f
: