Merge pull request #1460 from enjoy-digital/neorv32_params
cpu/neorv32/core: Avoid configure_litex_core_complex by passing param…
This commit is contained in:
commit
808cf1a466
|
@ -69,10 +69,6 @@ class NEORV32(CPU):
|
||||||
|
|
||||||
# CPU LiteX Core Complex Wrapper
|
# CPU LiteX Core Complex Wrapper
|
||||||
self.specials += Instance("neorv32_litex_core_complex",
|
self.specials += Instance("neorv32_litex_core_complex",
|
||||||
# Parameters.
|
|
||||||
#p_CONFIG = 2,
|
|
||||||
#p_DEBUG = False,
|
|
||||||
|
|
||||||
# Clk/Rst.
|
# Clk/Rst.
|
||||||
i_clk_i = ClockSignal("sys"),
|
i_clk_i = ClockSignal("sys"),
|
||||||
i_rstn_i = ~(ResetSignal() | self.reset),
|
i_rstn_i = ~(ResetSignal() | self.reset),
|
||||||
|
@ -104,6 +100,15 @@ class NEORV32(CPU):
|
||||||
build_dir = os.path.abspath(os.path.dirname(__file__)),
|
build_dir = os.path.abspath(os.path.dirname(__file__)),
|
||||||
work_package = "neorv32",
|
work_package = "neorv32",
|
||||||
force_convert = True,
|
force_convert = True,
|
||||||
|
params = dict(
|
||||||
|
p_CONFIG = {
|
||||||
|
"minimal" : 0,
|
||||||
|
"lite" : 1,
|
||||||
|
"standard" : 2,
|
||||||
|
"full" : 3
|
||||||
|
}[variant],
|
||||||
|
p_DEBUG = False,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add Verilog sources
|
# Add Verilog sources
|
||||||
|
@ -164,39 +169,5 @@ class NEORV32(CPU):
|
||||||
if not os.path.exists(os.path.join(cdir, vhd)):
|
if not os.path.exists(os.path.join(cdir, vhd)):
|
||||||
os.system(f"wget https://raw.githubusercontent.com/stnolting/neorv32/main/rtl/{directory}/{vhd} -P {cdir}")
|
os.system(f"wget https://raw.githubusercontent.com/stnolting/neorv32/main/rtl/{directory}/{vhd} -P {cdir}")
|
||||||
|
|
||||||
def configure_litex_core_complex(filename, variant):
|
|
||||||
# Read Wrapper.
|
|
||||||
lines = []
|
|
||||||
f = open(filename)
|
|
||||||
for l in f:
|
|
||||||
lines.append(l)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
# Configure.
|
|
||||||
_lines = []
|
|
||||||
for l in lines:
|
|
||||||
if "constant CONFIG" in l:
|
|
||||||
config = {
|
|
||||||
"minimal" : "0",
|
|
||||||
"lite" : "1",
|
|
||||||
"standard" : "2",
|
|
||||||
"full" : "3"
|
|
||||||
}[variant]
|
|
||||||
l = f"\tconstant CONFIG : natural := {config};\n"
|
|
||||||
_lines.append(l)
|
|
||||||
lines = _lines
|
|
||||||
|
|
||||||
# Write Wrapper.
|
|
||||||
f = open(filename, "w")
|
|
||||||
for l in lines:
|
|
||||||
f.write(l)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
configure_litex_core_complex(
|
|
||||||
filename = os.path.join(cdir, "neorv32_litex_core_complex.vhd"),
|
|
||||||
variant = variant,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def do_finalize(self):
|
def do_finalize(self):
|
||||||
assert hasattr(self, "reset_address")
|
assert hasattr(self, "reset_address")
|
||||||
|
|
Loading…
Reference in New Issue