1 # test case for LOAD / STORE Computation Unit.
4 from nmigen
.compat
.sim
import run_simulation
5 from nmigen
.cli
import verilog
, rtlil
6 from nmigen
import Module
, Signal
, Mux
, Cat
, Elaboratable
, Array
, Repl
7 from nmigen
.hdl
.rec
import Record
, Layout
10 from nmutil.latch import SRLatch, latchregister
11 from nmutil.byterev import byte_reverse
12 from nmutil.extend import exts
14 from soc.fu.regspec import RegSpecAPI
16 from openpower.decoder.power_enums import MicrOp, Function, LDSTMode
17 from soc.fu.ldst.ldst_input_record import CompLDSTOpSubset
18 from openpower.decoder.power_decoder2 import Data
19 from openpower.consts import MSR
22 from soc
.experiment
.compalu_multi
import go_record
, CompUnitRecord
23 from soc
.experiment
.l0_cache
import PortInterface
24 from soc
.experiment
.pimem
import LDSTException
25 from soc
.experiment
.compldst_multi
import LDSTCompUnit
26 from soc
.config
.test
.test_loadstore
import TestMemPspec
29 from nmutil
.util
import Display
31 ########################################
36 ########################################
39 class TestLDSTCompUnitMMU(LDSTCompUnit
):
41 def __init__(self
, rwid
, pspec
):
42 from soc
.experiment
.l0_cache
import TstL0CacheBuffer
43 self
.l0
= l0
= TstL0CacheBuffer(pspec
)
45 LDSTCompUnit
.__init
__(self
, pi
, rwid
, 4)
47 def elaborate(self
, platform
):
48 m
= LDSTCompUnit
.elaborate(self
, platform
)
49 m
.submodules
.l0
= self
.l0
50 # link addr-go direct to rel
51 m
.d
.comb
+= self
.ad
.go_i
.eq(self
.ad
.rel_o
)
55 def test_scoreboard_mmu():
58 pspec
= TestMemPspec(ldst_ifacetype
='mmu_cache_wb',
59 imem_ifacetype
='bare_wb',
65 dut
= TestLDSTCompUnitMMU(16,pspec
)
66 vl
= rtlil
.convert(dut
, ports
=dut
.ports())
67 with
open("test_ldst_comp_mmu1.il", "w") as f
:
70 run_simulation(dut
, ldst_sim(dut
), vcd_name
='test_ldst_comp.vcd')
72 ########################################
73 class TestLDSTCompUnitRegSpecMMU(LDSTCompUnit
):
75 def __init__(self
, pspec
):
76 from soc
.experiment
.l0_cache
import TstL0CacheBuffer
77 from soc
.fu
.ldst
.pipe_data
import LDSTPipeSpec
78 regspec
= LDSTPipeSpec
.regspec
79 self
.l0
= l0
= TstL0CacheBuffer(pspec
)
81 LDSTCompUnit
.__init
__(self
, pi
, regspec
, 4)
83 def elaborate(self
, platform
):
84 m
= LDSTCompUnit
.elaborate(self
, platform
)
85 m
.submodules
.l0
= self
.l0
86 # link addr-go direct to rel
87 m
.d
.comb
+= self
.ad
.go_i
.eq(self
.ad
.rel_o
)
91 def test_scoreboard_regspec_mmu():
94 pspec
= TestMemPspec(ldst_ifacetype
='mmu_cache_wb',
95 imem_ifacetype
='bare_wb',
101 dut
= TestLDSTCompUnitRegSpecMMU(pspec
)
102 vl
= rtlil
.convert(dut
, ports
=dut
.ports())
103 with
open("test_ldst_comp_mmu2.il", "w") as f
:
106 run_simulation(dut
, ldst_sim(dut
), vcd_name
='test_ldst_regspec.vcd')
109 if __name__
== '__main__':
110 test_scoreboard_regspec_mmu()
111 #only one test for now -- test_scoreboard_mmu()