convert boolean to std_logic

Discussion in 'VHDL' started by manolis kaliorakis, Dec 17, 2011.

  1. Hello to all,

    I am a beginner in using vhdl. I want to convert a signal boolean to
    std_logic. How could I achieve this?
    I am using these libraries:

    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;

    Thanks in advance
     
    manolis kaliorakis, Dec 17, 2011
    #1
    1. Advertising

  2. manolis kaliorakis

    KJ Guest

    On Dec 17, 8:56 am, manolis kaliorakis <>
    wrote:
    > Hello to all,
    >
    > I am a beginner in using vhdl. I want to convert a signal boolean to
    > std_logic. How could I achieve this?
    > I am using these libraries:
    >
    > library IEEE;
    > use IEEE.STD_LOGIC_1164.ALL;


    KJ note: Do not use the following libraries, use ieee.numeric_std
    instead
    > use IEEE.STD_LOGIC_ARITH.ALL;
    > use IEEE.STD_LOGIC_UNSIGNED.ALL;
    >


    You have to create your own function...here it is

    function To_Std_Logic(L: BOOLEAN) return std_ulogic is
    begin
    if L then
    return('1');
    else
    return('0');
    end if;
    end function To_Std_Logic;

    Kevin Jennings
     
    KJ, Dec 17, 2011
    #2
    1. Advertising

  3. On Dec 17, 5:56 pm, KJ <> wrote:
    > On Dec 17, 8:56 am, manolis kaliorakis <>
    > wrote:
    >
    > > Hello to all,

    >
    > > I am a beginner in using vhdl. I want to convert a signal boolean to
    > > std_logic. How could I achieve this?
    > > I am using these libraries:

    >
    > > library IEEE;
    > > use IEEE.STD_LOGIC_1164.ALL;

    >
    > KJ note:  Do not use the following libraries, use ieee.numeric_std
    > instead
    >
    > > use IEEE.STD_LOGIC_ARITH.ALL;
    > > use IEEE.STD_LOGIC_UNSIGNED.ALL;

    > k
    > You have to create your own function...here it is
    >
    >     function To_Std_Logic(L: BOOLEAN) return std_ulogic is
    >     begin
    >         if L then
    >             return('1');
    >         else
    >             return('0');
    >         end if;
    >     end function To_Std_Logic;
    >
    > Kevin Jennings


    Thanks for your response.It was very helpfull
     
    manolis kaliorakis, Dec 17, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. valentin tihomirov

    boolean to std_logic

    valentin tihomirov, Dec 31, 2003, in forum: VHDL
    Replies:
    3
    Views:
    14,386
    Mike Treseler
    Jan 5, 2004
  2. David R Brooks

    Re: boolean to std_logic

    David R Brooks, Dec 31, 2003, in forum: VHDL
    Replies:
    0
    Views:
    2,479
    David R Brooks
    Dec 31, 2003
  3. J Leonard
    Replies:
    4
    Views:
    12,695
    Mark Space
    Jan 19, 2008
  4. sajjadesrari

    how to convert real to std_logic

    sajjadesrari, Oct 26, 2009, in forum: VHDL
    Replies:
    2
    Views:
    2,056
    sajjadesrari
    Oct 31, 2009
  5. Metre Meter
    Replies:
    7
    Views:
    382
    Metre Meter
    Aug 6, 2010
Loading...

Share This Page