Closed ghost closed 8 years ago
Figured out question 1. BlackBoxes should be used as normal modules: intead of
val submodule = new Submodule
should be
val submodule = Module(new Submodule())
A blackbox is the same as a module except the verilog definition is not generated. Perhaps the following example will help illustrate. If I have generated a pipelined floating point add module in verilog using a tool (eg quartus). I called it "my_fp_add", the add takes 7 cycles, and has the inputs dataA, dataB, clock, rst and outputs result. This would be my blackbox:
class myFpAdd extends BlackBox {
setModuleName("my_fp_add")
renameClock("clk", "clock")
renameReset("rst")
val io = new Bundle {
val dataA = Flo(INPUT)
dataA.setName("dataA")
val dataB = Flo(INPUT)
dataB.setName("dataB")
val result = Flo(OUTPUT)
result.setName("result")
}
// Now the module will generate correctly as a BlackBox and is quite usable
// however we want to still use chisel to simulate the result
// This is achieved exactly the same way as normal chisel
// The blackbox just indicates not to put in generated code
// In this case it is quite easy to simulate
io.result := ShiftRegister(io.dataA + io.dataB, 7)
}
I haven't run it so might be syntax errs but you get the idea
Thank you for explanations!
Hello,
I would like to instantiate a submodule which is an already existing Verilog block. Here is my code:
However I am getting the following error:
Thanks for help.