[libre-riscv-dev] lots of stuff broken

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sat Jul 18 23:18:32 BST 2020

hiya jacob,

um, the div unit changes is breaking a lot of things that terminates
any possibility of doing work.

i can't run any of the compunit tests, or test_issuer.py (the main
test i use for verifying the core is operational).  could you make
sure in future to run some of the unit tests, and also rather than
make major adjustments to code that's in use in ways that cause
significant failures (only partially changing names of classes from
DIVXXX to DivXXX without doing a global search/replace throughout the
code), put in place migration plans?

for example: if you make major name changes without a global
search/replace, put a temporary variable (commented), "DIVXXX=DivXXX"
with a "TODO: complete transition to new name".

the better strategy would have been to start a new subdirectory with
the new code - or just new filenames

regarding DivPipeSpec:

class DivPipeSpec(CommonPipeSpec):
    def __init__(self, id_wid, div_pipe_kind):
        self.div_pipe_kind = div_pipe_kind
        self.core_config = div_pipe_kind.config.core_config

it's not designed for having extra parameters.  if you need two
different kinds, then that means having two differerent DivPipeSpec
classes: one for the Comb work, one for the Sync work.

then in compunits.py, different Function Units are declared as follows:

class DivFunctionUnitWhateverType(FunctionUnitBaseSingle):
    fnunit = Function.DIV
    def __init__(self, idx):
        super().__init__(DivPipeSpecWhateverType, DivBasePipe, idx)

class DivFunctionUnitCombType(FunctionUnitBaseSingle):
    fnunit = Function.DIV
    def __init__(self, idx):
        super().__init__(DivPipeSpecCombType, DivBasePipe, idx)

anyway.  i worked out that this is "fixable" by giving DivPipeSpec a
default argument.


compunits/compunits.py:221: UnusedElaboratable:
<soc.fu.compunits.compunits.DivFunctionUnit object at 0x7f0a131a57f0>
created but never used
  self.fus["%s%d" % (name, i)] = kls(i)
UnusedElaboratable: Enable tracemalloc to get the object allocation traceback
ERROR: run_all (__main__.TestRunner)
Traceback (most recent call last):
  File "simple/test/test_issuer.py", line 87, in run_all
    m.submodules.issuer = issuer = TestIssuer(pspec)
  File "/home/lkcl/src/libresoc/soc/src/soc/simple/issuer.py", line
39, in __init__
    self.core = core = NonProductionCore(pspec)
  File "/home/lkcl/src/libresoc/soc/src/soc/simple/core.py", line 67,
in __init__
    self.fus = AllFunctionUnits(pspec, pilist=[pi])
  File "/home/lkcl/src/libresoc/soc/src/soc/fu/compunits/compunits.py",
line 221, in __init__
    self.fus["%s%d" % (name, i)] = kls(i)
  File "/home/lkcl/src/libresoc/soc/src/soc/fu/compunits/compunits.py",
line 153, in __init__
    super().__init__(DivPipeSpec, DivBasePipe, idx)
  File "/home/lkcl/src/libresoc/soc/src/soc/fu/compunits/compunits.py",
line 108, in __init__
    pspec = speckls(id_wid=2)                # spec (NNNPipeSpec instance)
TypeError: __init__() missing 1 required positional argument: 'div_pipe_kind'

crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68

More information about the libre-riscv-dev mailing list