1

I'm diving into VHDL and I couldn't really grasp the idea(?) of weak signals.

I understand that '0' and '1' are (strong) signals. This is quite common knowledge from my point of view. How do weak signals now enter the arena?

Ben
  • 625
  • 9
  • 17

1 Answers1

3

VHDL had by default a 2-valued logic known as types bit and bit_vector. With IEEE Std. 1164, which was incorporated into VHDL itself, it got a 9-valued logic. In comparison, Verilog has only a fixed 4-valued logic (X, 0, 1, Z).

VHDL's std_ulogic type has:

  • U - uninitialized
  • X - strong unknown (error)
  • 0 - strong low
  • 1 - strong high
  • Z - tri state
  • W - weak unknown (error)
  • L - weak low
  • H - weak high
  • - - Don't care

All objects are initialized with type'left if no default value is given. There are multiple subtypes like x01z with are compatible to the Verilog logic system.

Weak signals are intended to model pullups and pulldowns. Thus it's possible to simulate OneWire, I²C and similar busses with pullups and pulldowns.

Using strong and weak signals makes mostly sense when signals are driven by multiple sources. In such a cases, the type use should be based on std_logic, which adds a resolution function to the base type. A resolution function computes the effective values from multiple sources.

Example: H and 0 results in 0 (pullups and ground is ground).

Paebbels
  • 3,917
  • 2
  • 19
  • 43
  • Thanks a lot! What exactly is the meaning of modelling pullups and pulldowns? In digital logic, there are basically only two signals (high and low). So how does 1 differ from H? – Ben Dec 20 '20 at 18:59
  • 1
    '1' is Vcc and 'H' is almost Vcc. Same for '0', which is ground and 'L' is almost ground. The voltage at a pullup or pulldown isn't exactly Vcc nor Gnd. VHDL allows you to model 4 values from Gnd via Low and High to Vcc. With this and a feature called resolution function, you can simulate in VHDL not only digital in-chip, but also board-level. If you have a VHDL file with this line SDA <= 'H';, it adds a pullup driver ('H') to the SDA line for an I²C communication link. When your chip drives 'Z', SDA will be 'H', but if you drive '0' it's '0'. Another chip will read low. – Paebbels Dec 20 '20 at 22:21
  • Thanks again! These are the exact words I feel like which are often missed out. – Ben Dec 21 '20 at 14:45
  • Hi, I would like to ask you another thing: Can you please help me to separate 'H' from 'Z'? I can say that 'H' is "almost 1 due to a pullup" (or pulldown?) and 'Z' corresponds to a Tri-State representing high impedance. For me this sounds quite identically. – Ben Dec 26 '20 at 18:08
  • Mybe it's better to continue this discussion on Gitter (Chat) for VHDL questions: https://gitter.im/vhdl/General – Paebbels Dec 27 '20 at 01:18