Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test modules with bundle/vec input?

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!

like image 322
apen Avatar asked Aug 11 '26 23:08

apen


2 Answers

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.

like image 178
Jack Koenig Avatar answered Aug 14 '26 23:08

Jack Koenig


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.

like image 39
Chick Markley Avatar answered Aug 14 '26 21:08

Chick Markley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!