function in VHDL- make binary

Moderator (Company: Titel) #5198285
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.

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.