This test runs correctly:
|
def test_rshift_parallel(): |
|
width = 5 |
|
num_in = 4 |
|
test_vals = [2,5,3,8] |
|
shift_amount = 2 |
|
in_type = Array[num_in, Array[width, In(BitIn)]] |
|
scope = Scope() |
|
args = ['I', in_type, 'O', Out(in_type)] + ClockInterface(False, False) |
|
|
|
testcircuit = DefineCircuit('Test', *args) |
|
|
|
rshift = RShiftParallel(num_in, shift_amount, in_type.T) |
|
wire(rshift.I, testcircuit.I) |
|
wire(testcircuit.O, rshift.O) |
|
|
|
EndCircuit() |
|
|
|
sim = CoreIRSimulator(testcircuit, testcircuit.CLK) |
|
|
|
for i, val in enumerate(test_vals): |
|
sim.set_value(testcircuit.I[i], int2seq(val, width), scope) |
|
sim.evaluate() |
|
for i, val in enumerate(test_vals[shift_amount:]): |
|
assert seq2int(sim.get_value(testcircuit.O[i + shift_amount])) == test_vals[i] |
The same test except using fault fails:
|
def test_fault_rshift_parallel(): |
|
width = 5 |
|
num_in = 4 |
|
test_vals = [2,5,3,8] |
|
shift_amount = 2 |
|
in_type = Array[num_in, Array[width, In(BitIn)]] |
|
args = ['I', in_type, 'O', Out(in_type)] |
|
|
|
testcircuit = DefineCircuit('Test', *args) |
|
|
|
rshift = RShiftParallel(num_in, shift_amount, in_type.T) |
|
wire(rshift.I, testcircuit.I) |
|
wire(testcircuit.O, rshift.O) |
|
|
|
EndCircuit() |
|
|
|
magma.compile("vBuild/" + testcircuit.name, testcircuit, output="coreir-verilog", |
|
passes=["rungenerators", "wireclocks-coreir", "verifyconnectivity --noclkrst", "flattentypes", "flatten", "verifyconnectivity --noclkrst", "deletedeadinstances"], |
|
namespaces=["aetherlinglib", "commonlib", "mantle", "coreir", "global"]) |
|
|
|
tester = fault.Tester(testcircuit) |
|
|
|
for i, val in enumerate(test_vals): |
|
tester.circuit.I[i] = val |
|
tester.eval() |
|
for i, val in enumerate(test_vals[shift_amount:]): |
|
tester.circuit.O[i + shift_amount].expect(test_vals[i]) |
|
tester.compile_and_run(target="verilator", skip_compile=True, directory="vBuild/") |
. It fails on the call the CoreIR compiler that generates verilog. The error message is below.
@rdaly525 any thoughts? This looks like a bug in CoreIR.
python: /home/david/dev/coreir/src/ir/context.cpp:112: void CoreIR::Context::die(): Assertion `0' failed.
Fatal Python error: Aborted
Current thread 0x00007efbff6e1740 (most recent call first):
File "/home/david/dev/pycoreir/coreir/module.py", line 135 in save_to_file
File "/home/david/dev/magma/magma/compile.py", line 56 in __compile_to_coreir
File "/home/david/dev/magma/magma/compile.py", line 136 in compile
This test runs correctly:
aetherling/tests/test_rshift.py
Lines 9 to 32 in 52143b2
The same test except using fault fails:
aetherling/tests/test_rshift.py
Lines 34 to 61 in 52143b2