EmbDev.net

Forum: FPGA, VHDL & Verilog function in VHDL- make binary


Author: Noa Cohen (Company: noacohen) (noa_cohen_2000)
Posted on:

Rate this post
0 useful
not useful
what the function MAKE_BINARY  does in VHDL ?
What its puprose?

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
1 useful
not useful
Noa C. wrote:
> what the function MAKE_BINARY  does in VHDL ?
Simply have a look in the source of the std_logic_arith package:
https://www.csee.umbc.edu/portal/help/VHDL/package...
    -- synopsys synthesis_off
    type tbl_type is array (STD_ULOGIC) of STD_ULOGIC;
    constant tbl_BINARY : tbl_type :=
  ('X', 'X', '0', '1', 'X', 'X', '0', '1', 'X');
    -- synopsys synthesis_on

    function MAKE_BINARY(A : STD_ULOGIC) return STD_ULOGIC is
  -- synopsys built_in SYN_FEED_THRU
    begin
  -- synopsys synthesis_off
      if (IS_X(A)) then
    assert false 
    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
    severity warning;
          return ('X');
      end if;
      return tbl_BINARY(A);
  -- synopsys synthesis_on
    end;

> What its puprose?
It takes the input vector and makes a '1' out of a '1' or a 'H", and it 
makes a '0' out of a '0' and a 'L', all the rest will be changed to 'X'.

BTW: I recoomend NOT to use the old Synopsys std_logic_arith libs. Use 
the numeric_std instead. It has all you will need.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig