How to use a ROM to display value to LED?

Discussion in 'VHDL' started by jam2310, May 2, 2010.

  1. jam2310

    jam2310

    Joined:
    May 2, 2010
    Messages:
    2
    I'm a newbie to VHDL,
    Seeking help to display to LED.
    I've stored 8 bits value into ROM (a distributed memory) core.
    I've declared the conponent in architechture:

    component LED_DISTMEM
    port (
    a: IN std_logic_VECTOR(11 downto 0);
    spo: OUT std_logic_VECTOR(7 downto 0));
    end component;

    I've instantiated in begin

    LED_DISTMEM_ins : LED_DISTMEM
    port map (
    a => a,
    spo => spo);

    when I have an input at a, i'll take the spo to display on LED.

    ---so i've written:


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

    ---- Uncomment the following library declaration if instantiating
    ---- any Xilinx primitives in this code.
    --library UNISIM;
    --use UNISIM.VComponents.all;

    entity LED_Display is
    Port ( CLK : in STD_LOGIC;
    RST : in STD_LOGIC;
    START_LED :in std_logic;
    LED : out STD_LOGIC_VECTOR (7 downto 0));
    end LED_Display;
    -------------------------------------------------------------
    ----------------------------------------------------
    architecture LED_DISP_ARC of LED_Display is

    component LED_DISTMEM
    port (
    a: IN std_logic_VECTOR(11 downto 0);
    spo: OUT std_logic_VECTOR(7 downto 0));
    end component;
    -- Synplicity black box declaration
    attribute syn_black_box : boolean;
    attribute syn_black_box of LED_DISTMEM: component is true;
    ---------
    begin

    LED_DISTMEM_ins : LED_DISTMEM
    port map (
    a => a,
    spo => spo);

    signal spo_temp : std_logic_Vector (7 downto 0);

    begin


    coding:process (CLK,RST)

    begin
    if RST = '1' then
    LED<= "00000000";
    elsif (CLK'event and CLK = '1') then
    if (START_LED ='1') then
    LED<= spo_temp;
    end if;
    end if;

    mapping :process (CLK,spo_temp)

    begin
    if RST = '1' then
    LED<= "00000000";
    elsif (CLK'event and CLK = '1') then
    spo<=spo_temp;
    end if;
    end if;
    end process;end LED_DISP_ARC;

    --Is this correct?
    --THanks!
     
    jam2310, May 2, 2010
    #1
    1. Advertising

  2. jam2310

    jeppe

    Joined:
    Mar 10, 2008
    Messages:
    348
    Location:
    Denmark
    You will need to define the ROM content - I believe the rest is ok.
    How ever - find inspiration here: jjmk.dk/MMMI/Lessons/07_Memory/No1_ROM/index.htm

    Your welcome
     
    jeppe, May 2, 2010
    #2
    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. network lines

    VHDL code to light up LED???

    network lines, May 25, 2004, in forum: VHDL
    Replies:
    8
    Views:
    8,599
    Symon
    May 27, 2004
  2. hangeonos
    Replies:
    0
    Views:
    777
    hangeonos
    May 24, 2009
  3. me@privacy.net
    Replies:
    2
    Views:
    300
    me@privacy.net
    May 29, 2010
  4. frznchckn
    Replies:
    0
    Views:
    677
    frznchckn
    Jul 20, 2010
  5. Petr Jakes
    Replies:
    4
    Views:
    366
    Petr Jakes
    Mar 5, 2012
Loading...

Share This Page