Black Box Not Found Exception

Viewed 107

I am trying to include a blackbox module in my chisel code. I used the addResource construct and gave the right path to the verilog file. But I am not sure why I am getting this error.

[error] (run-main-0) firrtl.transforms.BlackBoxNotFoundException: BlackBox '../resources/MyBlackBox.v' not found. Did you misspell it? Is it in src/{main,test}/resources? [error] null

Here is my code snippet

import chisel3._
import chisel3.util.{HasBlackBoxResource}

class MyBlackBox(p : Parameters) extends BlackBox with HasBlackBoxResource{
    val io = IO(new Bundle(){
    val in1 = Input(UInt(32.W))
    val in2 = Input(UInt(32.W))
    val out1 = Output(UInt(32.W))
    val out2 = Output(UInt(32.W))
})
addResource("../resources/MyBlackBox.v")
}

And here is the verilog code

module MyBlackBox(
input [31:0] in1,
input [31:0] in2,
output [31:0] out1,
output [31:0] out2
);

always@(*) begin
out1 <= in1 * in1;
out2 <= in2 * in2;  
end
endmodule

Here is the class where I invoke the blackbox

class dummy extends Module{
val io = IO(new Bundle {
val in1 = Input(UInt(32.W))
val in2 = Input(UInt(32.W))
val out1 = Output(UInt(32.W))
val out2 = Output(UInt(32.W))
})
val bb = Module(new MyBlackBox)
bb.io.in1 := io.in1
bb.io.in2 := io.in2
io.out1 := bb.io.out1
io.out2 := bb.io.out2

}

And the testbench is as follows

import chisel3._
import chisel3.iotesters._

class dummy_Driver(dut : dummy) extends PeekPokeTester(dut){}

object dummy_Driver extends App{
    chisel3.iotesters.Driver.execute(Array("--backend-name", "verilator", "--target-dir",
    "test_run_dir/dummy", "--top-name", "dummy"), 
    () => new dummy)
    { c => new dummy_Driver(c)}
}
0 Answers
Related