chiseltest icon indicating copy to clipboard operation
chiseltest copied to clipboard

Allow expect with BitPat.

Open sequencer opened this issue 5 years ago • 5 comments

In the bus protocol expecting. There is a case that we only need to expecting a part of signals. For example: To test TileLink protocol, I'm expecting a 128-bit width of data with mask in 0b00000000000000000000000011111111, I expect data to be 0h12345678. but dut return a 0h12345678123456781234567812345678. other than 12345678 in LSB, all data should be ignored in expecting. So BitPat as literal, UInt/Bits as Data should be implemented for this case.

sequencer avatar Apr 25 '20 03:04 sequencer

Yeah, I think it makes sense to create a testableBits class that can take a BitPat as the comparison value, if you want to write an PR it. That being said, though BitPat is a Chisel construct, the implementation is more bolted on in utils, and usage / support probably isn't as uniform as other core Chisel constructs.

ducky64 avatar Apr 25 '20 18:04 ducky64

Yes I'm going to PR it after I finish #156

sequencer avatar Apr 26 '20 03:04 sequencer

Being able to write io.foo.expect("b????_???1".U) in my tests would be amazing. :heart:

Is this what you're suggesting?

nullobject avatar May 29 '20 05:05 nullobject

Yes, I think that is the idea.

Nit: the syntax might be more of io.foo.expect(BitPat("b????_???1")), since UInts don't support unknown fields, so BitPat is a separate class entirely.

ducky64 avatar Jun 04 '20 07:06 ducky64

Hi @sequencer! Any updates on this feature?

kammoh avatar Jul 16 '21 02:07 kammoh