rdaly525 / coreir

BSD 3-Clause "New" or "Revised" License
101 stars 24 forks source link

Assertion error in wireclocks-coreir #233

Closed leonardt closed 7 years ago

leonardt commented 7 years ago
coreir -p wireclocks-coreir -i popcount8.json
ERROR: Cannot select  From self
  Type: {'in1':Bit, 'out':BitIn, 'in2':Bit, 'in0':Bit}

Assertion failed: (type->canSel(selStr)), function sel, file wireable.cpp, line 31.
zsh: abort      coreir -p wireclocks-coreir -i popcount8.json

popcount8.json

{"top":"global.PopCount8",
"namespaces":{
  "global":{
    "modules":{
      "Op":{
        "type":["Record",{
          "in0":"BitIn",
          "in1":"BitIn",
          "in2":"BitIn",
          "out":"Bit"
        }],
        "instances":{
          "inst0":{
            "modref":"coreir.bitand"
          },
          "inst1":{
            "modref":"coreir.bitand"
          },
          "inst2":{
            "modref":"coreir.bitand"
          },
          "inst3":{
            "modref":"global.fold_or3None"
          }
        },
        "connections":[
          ["self.out","inst3.out"],
          ["self.in2","inst2.in0"],
          ["self.in2","inst1.in1"],
          ["self.in1","inst1.in0"],
          ["self.in1","inst0.in1"],
          ["self.in0","inst2.in1"],
          ["self.in0","inst0.in0"],
          ["inst3.in2","inst2.out"],
          ["inst3.in1","inst1.out"],
          ["inst3.in0","inst0.out"]
        ]
      },
      "PopCount8":{
        "type":["Record",{
          "I":["Array",8,"BitIn"],
          "O":["Array",4,"Bit"]
        }],
        "instances":{
          "bit_const_GND":{
            "modref":"coreir.bitconst",
            "configargs":{"value":0}
          },
          "inst0":{
            "modref":"global.fold_xor3None"
          },
          "inst1":{
            "modref":"global.Op"
          },
          "inst10":{
            "modref":"global.fold_xor3None"
          },
          "inst11":{
            "modref":"global.Op"
          },
          "inst12":{
            "modref":"global.fold_xor3None"
          },
          "inst13":{
            "modref":"global.Op"
          },
          "inst2":{
            "modref":"global.fold_xor3None"
          },
          "inst3":{
            "modref":"global.Op"
          },
          "inst4":{
            "modref":"global.fold_xor3None"
          },
          "inst5":{
            "modref":"global.Op"
          },
          "inst6":{
            "modref":"global.fold_xor3None"
          },
          "inst7":{
            "modref":"global.Op"
          },
          "inst8":{
            "modref":"global.fold_xor3None"
          },
          "inst9":{
            "modref":"global.Op"
          }
        },
        "connections":[
          ["self.O.3","inst13.out"],
          ["self.O.2","inst12.out"],
          ["self.O.1","inst10.out"],
          ["self.O.0","inst8.out"],
          ["self.I.7","inst9.in1"],
          ["self.I.7","inst8.in1"],
          ["self.I.6","inst5.in2"],
          ["self.I.6","inst4.in2"],
          ["self.I.5","inst3.in2"],
          ["self.I.5","inst2.in2"],
          ["self.I.4","inst3.in1"],
          ["self.I.4","inst2.in1"],
          ["self.I.3","inst3.in0"],
          ["self.I.3","inst2.in0"],
          ["self.I.2","inst1.in2"],
          ["self.I.2","inst0.in2"],
          ["self.I.1","inst1.in1"],
          ["self.I.1","inst0.in1"],
          ["self.I.0","inst1.in0"],
          ["self.I.0","inst0.in0"],
          ["inst9.out","inst11.in1"],
          ["inst9.out","inst10.in1"],
          ["inst9.in2","bit_const_GND.out"],
          ["inst9.in0","inst4.out"],
          ["inst8.in2","bit_const_GND.out"],
          ["inst8.in0","inst4.out"],
          ["inst7.out","inst13.in0"],
          ["inst7.out","inst12.in0"],
          ["inst7.in2","inst5.out"],
          ["inst7.in1","inst3.out"],
          ["inst7.in0","inst1.out"],
          ["inst6.out","inst11.in0"],
          ["inst6.out","inst10.in0"],
          ["inst6.in2","inst5.out"],
          ["inst6.in1","inst3.out"],
          ["inst6.in0","inst1.out"],
          ["inst5.in1","inst2.out"],
          ["inst5.in0","inst0.out"],
          ["inst4.in1","inst2.out"],
          ["inst4.in0","inst0.out"],
          ["inst13.in2","bit_const_GND.out"],
          ["inst13.in1","inst11.out"],
          ["inst12.in2","bit_const_GND.out"],
          ["inst12.in1","inst11.out"],
          ["inst11.in2","bit_const_GND.out"],
          ["inst10.in2","bit_const_GND.out"]
        ]
      },
      "fold_or3None":{
        "type":["Record",{
          "in0":"BitIn",
          "in1":"BitIn",
          "in2":"BitIn",
          "out":"Bit"
        }],
        "instances":{
          "inst0":{
            "modref":"coreir.bitor"
          },
          "inst1":{
            "modref":"coreir.bitor"
          }
        },
        "connections":[
          ["self.out","inst1.out"],
          ["self.in2","inst1.in1"],
          ["self.in1","inst0.in1"],
          ["self.in0","inst0.in0"],
          ["inst1.in0","inst0.out"]
        ]
      },
      "fold_xor3None":{
        "type":["Record",{
          "in0":"BitIn",
          "in1":"BitIn",
          "in2":"BitIn",
          "out":"Bit"
        }],
        "instances":{
          "inst0":{
            "modref":"coreir.bitxor"
          },
          "inst1":{
            "modref":"coreir.bitxor"
          }
        },
        "connections":[
          ["self.out","inst1.out"],
          ["self.in2","inst1.in1"],
          ["self.in1","inst0.in1"],
          ["self.in0","inst0.in0"],
          ["inst1.in0","inst0.out"]
        ]
      }
    }
  }
}
}
leonardt commented 7 years ago

Fixed by https://github.com/rdaly525/coreir/pull/234, thanks @rdaly525 !