1

Does System C support tri-state logic? That is, bits that can get 0, 1 or X, where X means "unknown"?

If it does, does it also support vectors that can contain Xes, including logic and arithmetic operations?

Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
  • 1
    Tri-state actually has `Z` value, rather than `X`. It means hi-impedance, and in practice means that the output is electrically disconnected from the input. OTOH, `X` is an unknown, or don't-care logical state, which can be either `0` or `1`. – ysap May 03 '16 at 15:34

2 Answers2

2

Here is what you need:

It does not have tri-state variables, but quad-state (is that correct? :P) variables (0,1,X,Z). More about it in the above links. It also supports vectors of those variables.

Hope I helped you a little bit :)

Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
George
  • 3,765
  • 21
  • 25
2

Yeah, you're looking for the sc_logic and sc_lv types which are 4 state variables: 0, 1, X, and Z. Pay attention to how they interact when you resolve them together. There's a nice tables on the asic-world.com site taken directly from the SystemC User Manual.

Note though that this doesn't work like in Verilog where X can also act as a wildcard. I had to build my own function to add that functionality.

spellman23
  • 31
  • 4