3

How do you test modules with IO input port of type Vec, Bundle, or composition of these?

In other words, using PeekPokeTester, how do you properly poke() a port that is of type Vec, Bundle, or more complex composition of these two types? Thanks!

2 Answers 2

2

The PeekPokeTester has poke methods for Bundle and Vec, but I don't think they have handling for nested versions.

From the ScalaDoc (all Chisel-related ScalaDoc can be found at https://www.chisel-lang.org/):

def poke(signal: Aggregate, value: IndexedSeq[BigInt]): Unit
def poke(signal: Bundle, map: Map[String, BigInt]): Unit

These accept types analogous to Bundle and Vec, but unfortunately it doesn't appear to be nested which isn't ideal.

Sign up to request clarification or add additional context in comments.

Comments

2

You can always write special helper functions that just specify each individual field to poke, but it is not very general.

Better solution is to use the newer chisel unit test library ChiselTest. It has support for poking, peeking and expecting Bundle literals. Specifically check out the examples in ChiselTest unittest BundleLiteralsSpec.

VectorLiterals are still a work in progress in Chisel but they are easier than bundles to write more generic helper functions for.

1 Comment

I tried to use the library. I can compile and run the provided examples, but when I try to add tests on my own code, I was unable to get .Lit() function working on my custom data type. Very strange and confusing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.