Skip to content

Commit 09fbbca

Browse files
committedFeb 26, 2015
gensoc: cpus now directly add their verilog sources
1 parent 5e8a0c4 commit 09fbbca

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed
 

Diff for: ‎misoclib/gensoc/__init__.py

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from operator import itemgetter
32
from math import ceil
43

@@ -48,9 +47,9 @@ def __init__(self, platform, clk_freq, cpu_reset_address, sram_size=4096, l2_siz
4847

4948
# Wishbone
5049
if cpu_type == "lm32":
51-
self.submodules.cpu = lm32.LM32(cpu_reset_address)
50+
self.submodules.cpu = lm32.LM32(platform, cpu_reset_address)
5251
elif cpu_type == "or1k":
53-
self.submodules.cpu = mor1kx.MOR1KX(cpu_reset_address)
52+
self.submodules.cpu = mor1kx.MOR1KX(platform, cpu_reset_address)
5453
else:
5554
raise ValueError("Unsupported CPU type: "+cpu_type)
5655
self.submodules.sram = wishbone.SRAM(sram_size)
@@ -74,18 +73,6 @@ def __init__(self, platform, clk_freq, cpu_reset_address, sram_size=4096, l2_siz
7473
log2_int(l2_size) if l2_size else 0)
7574
self.submodules.timer0 = timer.Timer()
7675

77-
# add CPU Verilog sources
78-
if cpu_type == "lm32":
79-
platform.add_sources(os.path.join("extcores", "lm32", "submodule", "rtl"),
80-
"lm32_cpu.v", "lm32_instruction_unit.v", "lm32_decoder.v",
81-
"lm32_load_store_unit.v", "lm32_adder.v", "lm32_addsub.v", "lm32_logic_op.v",
82-
"lm32_shifter.v", "lm32_multiplier.v", "lm32_mc_arithmetic.v",
83-
"lm32_interrupt.v", "lm32_ram.v", "lm32_dp_ram.v", "lm32_icache.v",
84-
"lm32_dcache.v", "lm32_debug.v", "lm32_itlb.v", "lm32_dtlb.v")
85-
platform.add_verilog_include_path(os.path.join("extcores", "lm32"))
86-
if cpu_type == "or1k":
87-
platform.add_source_dir(os.path.join("extcores", "mor1kx", "submodule", "rtl", "verilog"))
88-
8976
def register_rom(self, rom_wb_if, bios_size=0xa000):
9077
if self._rom_registered:
9178
raise FinalizeError

Diff for: ‎misoclib/lm32/__init__.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import os
2+
13
from migen.fhdl.std import *
24
from migen.bus import wishbone
35

46
class LM32(Module):
5-
def __init__(self, eba_reset):
7+
def __init__(self, platform, eba_reset):
68
self.ibus = i = wishbone.Interface()
79
self.dbus = d = wishbone.Interface()
810
self.interrupt = Signal(32)
@@ -49,3 +51,12 @@ def __init__(self, eba_reset):
4951
self.ibus.adr.eq(i_adr_o[2:]),
5052
self.dbus.adr.eq(d_adr_o[2:])
5153
]
54+
55+
# add Verilog sources
56+
platform.add_sources(os.path.join("extcores", "lm32", "submodule", "rtl"),
57+
"lm32_cpu.v", "lm32_instruction_unit.v", "lm32_decoder.v",
58+
"lm32_load_store_unit.v", "lm32_adder.v", "lm32_addsub.v", "lm32_logic_op.v",
59+
"lm32_shifter.v", "lm32_multiplier.v", "lm32_mc_arithmetic.v",
60+
"lm32_interrupt.v", "lm32_ram.v", "lm32_dp_ram.v", "lm32_icache.v",
61+
"lm32_dcache.v", "lm32_debug.v", "lm32_itlb.v", "lm32_dtlb.v")
62+
platform.add_verilog_include_path(os.path.join("extcores", "lm32"))

Diff for: ‎misoclib/mor1kx/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import os
2+
13
from migen.fhdl.std import *
24
from migen.bus import wishbone
35

46
class MOR1KX(Module):
5-
def __init__(self, reset_pc):
7+
def __init__(self, platform, reset_pc):
68
self.ibus = i = wishbone.Interface()
79
self.dbus = d = wishbone.Interface()
810
self.interrupt = Signal(32)
@@ -71,3 +73,6 @@ def __init__(self, reset_pc):
7173
self.ibus.adr.eq(i_adr_o[2:]),
7274
self.dbus.adr.eq(d_adr_o[2:])
7375
]
76+
77+
# add Verilog sources
78+
platform.add_source_dir(os.path.join("extcores", "mor1kx", "submodule", "rtl", "verilog"))

0 commit comments

Comments
 (0)
Please sign in to comment.