EmbDev.net

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


von Noa C. (Company: noacohen) (noa_cohen_2000)


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

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
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/packages/std_logic_arith_syn.vhd
1
    -- synopsys synthesis_off
2
    type tbl_type is array (STD_ULOGIC) of STD_ULOGIC;
3
    constant tbl_BINARY : tbl_type :=
4
  ('X', 'X', '0', '1', 'X', 'X', '0', '1', 'X');
5
    -- synopsys synthesis_on
6
7
    function MAKE_BINARY(A : STD_ULOGIC) return STD_ULOGIC is
8
  -- synopsys built_in SYN_FEED_THRU
9
    begin
10
  -- synopsys synthesis_off
11
      if (IS_X(A)) then
12
    assert false 
13
    report "There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es)."
14
    severity warning;
15
          return ('X');
16
      end if;
17
      return tbl_BINARY(A);
18
  -- synopsys synthesis_on
19
    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.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.