Uriht
Uriht

Reputation: 1

An error occured while compling chisel test - could not find implicit value for evidence parameter of type

I need to write a chisel test for the simple passthrough module with type parameters. Tin <: Data: Ring, Tout <: Data: Ring

class PassThrough[ 
  Tin <: Data: Ring,
  Tout <: Data: Ring](genIn: Tin, genOut: Tout) extends Module { 
  
  val io = IO( new Bundle { 
    val in = Flipped(Decoupled(genIn)) 
    val out = Decoupled(genOut) } )
  
  io.in.ready := io.out.ready 
  io.out.valid := io.in.valid 
  io.out.bits <> io.in.bits.asTypeOf(genOut) 

} 

My idea for the test is to store all the possible types of genIn and genOut as entries using a case class, then run the test for each entry. Following is the code section for the test resulting in an error. The detailed error messages are as follows:

could not find implicit value for evidence parameter of type dsptools.numbers.Ring[chisel3.Bits with chisel3.Num[_ >: chisel3.SInt with chisel3.UInt <: chisel3.Bits]] 

[error]             test(new PassThrough( 

code

case class Entry[ 
    Tin <: Data: Ring,  
    Tout <: Data: Ring]( 
        genIn: Tin, 
        genOut: Tout 
    ) 

class PassThroughTester extends AnyFlatSpec with ChiselScalatestTester { 
    "PassThrough" should "work for all vlaid input type" in { 

        val tesCase = Seq( 
            Entry(UInt(8.W), UInt(10.W)), 
            Entry(SInt(8.W), SInt(8.W)) 
        ) 

        Seq.tabulate(tesCase.length){ i =>  
            val genIn = tesCase(i).genIn 
            val genOut = tesCase(i).genOut 

            test(new PassThrough( 
                genIn, 
                genOut)).withAnnotations(Seq(WriteVcdAnnotation)) 
                {   dut =>   
                    dut.io.in.initSource().setSourceClock(dut.clock) 
                    dut.io.out.initSink().setSinkClock(dut.clock) 

                    val inputSeq = seqToBits(genIn, Seq(1,2,3,4,5) ) 
                    val outSeq = seqToBits(genOut, Seq(1,2,3,4,5)) 

                    fork { 
                        dut.io.in.enqueueSeq(inputSeq) 
                    }.fork { 
                    for (expected <- outSeq) { 
                        dut.io.out.expectDequeue(expected) 
                        dut.clock.step(5)
                    } 
                    }.join() 
                } 
        } 
    } 
} 

I'm seeking help to resolve this error and would appreciate guidance on the correct method to implement this test.

Upvotes: 0

Views: 22

Answers (0)

Related Questions