# generation for subtraction, and handling of immediates should happen
# in the base class (CommonInputStage.elaborate).
from soc.fu.alu.input_stage import ALUInputStage
-from soc.fu.div.pipe_data import DIVInputData
+from soc.fu.div.pipe_data import DivInputData
# simply over-ride ALUInputStage ispec / ospec
def __init__(self, pspec):
super().__init__(pspec)
- def ispec(self): return DIVInputData(self.pspec)
- def ospec(self): return DIVInputData(self.pspec)
+ def ispec(self): return DivInputData(self.pspec)
+ def ospec(self): return DivInputData(self.pspec)
comb += xer_ov.eq(Repl(ov, 2)) # set OV _and_ OV32
##########################
- # main switch for DIV
+ # main switch for Div
o = self.o.o.data
DivPipeCoreInterstageData, DivPipeCoreOutputData)
-class DIVInputData(IntegerData):
+class DivInputData(IntegerData):
regspec = [('INT', 'ra', '0:63'), # RA
('INT', 'rb', '0:63'), # RB/immediate
('XER', 'xer_so', '32'), ] # XER bit 32: SO
self.cr0 = self.cr_a
-class DIVPipeSpec(CommonPipeSpec):
- regspec = (DIVInputData.regspec, DivMulOutputData.regspec)
+class DivPipeSpec(CommonPipeSpec):
+ regspec = (DivInputData.regspec, DivMulOutputData.regspec)
opsubsetkls = CompLogicalOpSubset
core_config = DivPipeCoreConfig(
bit_width=64,
)
-class CoreBaseData(DIVInputData):
+class CoreBaseData(DivInputData):
def __init__(self, pspec, core_data_class):
super().__init__(pspec)
self.core = core_data_class(pspec.core_config)
return [core_final, div_out, alu_out]
-class DIVBasePipe(ControlBase):
+class DivBasePipe(ControlBase):
def __init__(self, pspec, compute_steps_per_stage=4):
ControlBase.__init__(self)
self.pipe_start = DivStagesStart(pspec)
from nmigen import (Module, Signal, Cat, Repl, Mux, Const, Array)
from nmutil.pipemodbase import PipeModBase
-from soc.fu.div.pipe_data import DIVInputData
+from soc.fu.div.pipe_data import DivInputData
from ieee754.part.partsig import PartitionedSignal
from soc.decoder.power_enums import MicrOp
self.fields.create_specs()
def ispec(self):
- return DIVInputData(self.pspec)
+ return DivInputData(self.pspec)
def ospec(self):
return CoreInputData(self.pspec)
comb += self.o.div_by_zero.eq(divisor_o == 0)
##########################
- # main switch for DIV
+ # main switch for Div
with m.Switch(op.insn_type):
# div/mod takes straight (absolute) dividend
from soc.config.endian import bigendian
from soc.fu.test.common import (TestCase, ALUHelpers)
-from soc.fu.div.pipeline import DIVBasePipe
-from soc.fu.div.pipe_data import DIVPipeSpec
+from soc.fu.div.pipeline import DivBasePipe
+from soc.fu.div.pipe_data import DivPipeSpec
import random
def get_cu_inputs(dec2, sim):
- """naming (res) must conform to DIVFunctionUnit input regspec
+ """naming (res) must conform to DivFunctionUnit input regspec
"""
res = {}
# should have. However, this was really slow, since it needed to
# create and tear down the dut and simulator for every test case.
-# Now, instead of doing that, every test case in DIVTestCase puts some
+# Now, instead of doing that, every test case in DivTestCase puts some
# data into the test_data list below, describing the instructions to
# be tested and the initial state. Once all the tests have been run,
# test_data gets passed to TestRunner which then sets up the DUT and
# takes around 3 seconds
-class DIVTestCase(FHDLTestCase):
+class DivTestCase(FHDLTestCase):
test_data = []
def __init__(self, name):
self.run_tst_program(Program(lst, bigendian), initial_regs)
def tst_ilang(self):
- pspec = DIVPipeSpec(id_wid=2)
- alu = DIVBasePipe(pspec)
+ pspec = DivPipeSpec(id_wid=2)
+ alu = DivBasePipe(pspec)
vl = rtlil.convert(alu, ports=alu.ports())
with open("div_pipeline.il", "w") as f:
f.write(vl)
m.submodules.pdecode2 = pdecode2 = PowerDecode2(pdecode)
- pspec = DIVPipeSpec(id_wid=2)
- m.submodules.alu = alu = DIVBasePipe(pspec)
+ pspec = DivPipeSpec(id_wid=2)
+ m.submodules.alu = alu = DivBasePipe(pspec)
comb += alu.p.data_i.ctx.op.eq_from_execute1(pdecode2.e)
comb += alu.n.ready_i.eq(1)
if __name__ == "__main__":
unittest.main(exit=False)
suite = unittest.TestSuite()
- suite.addTest(TestRunner(DIVTestCase.test_data))
+ suite.addTest(TestRunner(DivTestCase.test_data))
runner = unittest.TextTestRunner()
runner.run(suite)