Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Bidirectional buffer

Hi,

I am working on Altera FPGA.

Please help me to code a Bidirectional bus using HDL.

Can anyone share a code for this.

Regards,

freak

14 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    'X' means the signal has an undefined state. This is because when data_out_ena = '0', io_data is tristated and it's supposed to be driven by an external source. If you dont' specify any external signal, data_in state is indeed undefined.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks Cris72 for the feedback.

    However, I have already defined my io_data to be 'Z' in the testbench but the problem is the data_in is 'X' instead of Z when in tri-state condition. Any other possible root cause?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    AFAIK the tristate condition only applies to output drive: the actual signal state depends on other active drivers and in the real world it always switches either low or high according to the physical behaviour of logic gates (CMOS, TTL, presence of pullups or pulldown...). In any case the real signal always falls into a specific state, low or high: there is not a 'tristate' level.

    Without an explicit specification, the simulator can't determine what the real signal status will be, then it indeed place it as 'undefined'
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    In any case the real signal always falls into a specific state, low or high.

    --- Quote End ---

    Not necessarily. A floating pin without pull/up, pull-down or hold circuit might also arbitrarily oscillate between '1' and '0'. 'X' in simulation can be understood as reflecting this unknown state.

    --- Quote Start ---

    there is not a 'tristate' level.

    --- Quote End ---

    That's the essential point. 'Z' can't be detected as an input state.