chisel icon indicating copy to clipboard operation
chisel copied to clipboard

[ChiselSim] ChiselEnum does not provide peek/poke methods and user-friendly API

Open carlosedp opened this issue 1 year ago • 4 comments

While rewriting some tests from chiseltest to ChiselSim, I've noticed ChiselEnum is not handled by the Peek/Poke API.

In a test with c.io.inst.peek() should be(inst) where inst is a ChiselEnum.Type, I get: value peek is not a member of chiselv.Instruction.Type.

The closest thing I could get to work is

c.io.inst.peekValue().asBigInt should be(inst.litValue)

Which is very convoluted and not user-friendly.

carlosedp avatar Jun 23 '24 20:06 carlosedp

Would this be the API you're looking for?

kammoh avatar Jun 24 '24 00:06 kammoh

Having peek() on ChiselEnum would be nice... but it's not in merged into Chisel, right?

carlosedp avatar Jun 24 '24 20:06 carlosedp

Having peek() on ChiselEnum would be nice... but it's not in merged into Chisel, right?

Not yet, but @kammoh has opened a draft PR adding it (among many other improvements): https://github.com/chipsalliance/chisel/pull/4209

I am reviewing, but got sick over the weekend so am not quite at 100% 🙃

jackkoenig avatar Jun 24 '24 20:06 jackkoenig

Oh, nice! just saw it mentioned! Commented here before I saw it.

Take care my friend! Hope you get better soon :)

carlosedp avatar Jun 24 '24 20:06 carlosedp