Forum Discussion

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

address decoding in vhdl

hello,

I have a soft-core processor and an uart. in order to send the data from output of the processor to the input of uart vhdl module, i'm thinking that i need address decoding to writes the data into uart?? am i right?? but to do the address decoding in vhdl, i dont have any idea how to write it..can someone guide me on how to do this ?? Thx very much

regard,

bruno

18 Replies

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

    --- Quote Start ---

    hello vizzie,

    are selection lines the output data? and "00", "01" for example as addresses for the selection_lines??

    --- Quote End ---

    That's right. Selection lines is the output of the decoder. "00", "01" are the addresses from the hypothetical source; in this case your zpu processor.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    "00", "01" are the addresses which you will be decoding. The "0001", "0010" etc. are the output selection lines of the decoder.

    --- Quote End ---

    hello vizzie,

    are selection lines the output data? and "00", "01" for example as addresses for the selection_lines??
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hello,

    in my attachment is my zpu_core(my processor) and a uart. mem_write is data output from my processor.it has 32 bits width.how to write an address decoder between zpu_core and uart serial?? i'm still thinking about it...any starting idea would be greatly appreciated..

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

    --- Quote Start ---

    "00", "01" are the addresses which you will be decoding. The "0001", "0010" etc. are the output selection lines of the decoder.

    --- Quote End ---

    i still understand what you meant. the data output of my soft-core processor is 32 bits width. this data output will be passed to the input of uart. do i need address choices when only uart is connected to the processor and no other??
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    which one is the address for the uart? 00 or 01 0r 10 or 11? should i fix the address of uart in my uart module?

    --- Quote End ---

    "00", "01" are the addresses which you will be decoding. The "0001", "0010" etc. are the output selection lines of the decoder.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    which one is the address for the uart? 00 or 01 0r 10 or 11? should i fix the address of uart in my uart module?

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

    --- Quote Start ---

    hello,

    but to do the address decoding in vhdl, i dont have any idea how to write it..can someone guide me on how to do this ??

    --- Quote End ---

    It is very simple to write the VHDL code for an address decoder. A general code can be as follows:

    2-to-4 address decoder: Using if-else construct

    ====================

    if address = "00" then

    selection_lines <= "0001";

    elsif address = "01" then

    selection_lines <= "0010";

    elsif address = "10" then

    selection_lines <= "0100";

    else address = "11" then

    selection_lines <= "1000";

    end if;

    ===================

    You can also use "case-select" and "when-else" constructs to code an address decoder.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can use the higher address bus lines.

    Example: If you use the a12 and a13 lines

    cs=a12 and a13;

    cs is the chip select signal for uart. In this case the base address is 0x3000