VHDL Register file-help needed for a student

Discussion in 'Hardware' started by draaknar, Sep 27, 2013.

  1. draaknar

    draaknar

    Joined:
    Sep 26, 2013
    Messages:
    3
    library IEEE;
    use ieee.std_logic_1164.all;
    USE ieee.std_logic_signed.all;
    use work.all;
    use assembler_code.all;
    use cpu_package.all;

    ENTITY registerfil IS
    PORT(

    clk : IN std_logic;
    data_in : IN data_word;
    data_out_1 : OUT data_word;
    data_out_0 : OUT data_word;
    sel_in : IN std_logic_vector (1 downto 0);
    sel_out_1 : IN std_logic_vector (1 downto 0);
    sel_out_0 : IN std_logic_vector (1 downto 0);
    rw_reg : in std_logic);

    END ENTITY registerfil;

    ARCHITECTURE RTL of registerfil is
    type test_register is array(3 downto 0) of std_logic_vector(3 downto 0);
    signal regs:test_register;
    signal data_in_temp : std_logic_vector(data_size-1 downto 0);

    begin

    logic:process(rw_reg)

    begin

    if rw_reg= '0' then
    regs(conv_integer(sel_in))<= data_in_temp;
    end if ;
    data_out_1<= regs(conv_integer(sel_out_0));
    data_out_0<= regs(conv_integer(sel_out_1));

    end process;

    las_in: process (clk)

    begin

    if rising_edge(clk) then
    data_in_temp <= data_in; -- bättre om du skriver in i regs hä

    end if;

    end process;

    end RTL;




    Hello im new to vhdl, and my code works i can simulate it to but i get errors, and cant save my values in my register array. My main point is to save values in the register "regs that i have created but if feels buggy.. Could you give me some help or tips to make the code better ? My main point is to save values in the register "regs that i have created but if feels buggy.

    regards, John schaizar
    draaknar, Sep 27, 2013
    #1
    1. Advertising

  2. draaknar

    draaknar

    Joined:
    Sep 26, 2013
    Messages:
    3
    Ok, i got the answer .


    my sel_in(11) went to --> -2 and not 3 so it was two complement form, i just wrote unsigned before it and wuualaa..
    draaknar, Sep 27, 2013
    #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. Geoff Pearson

    Office 2003 Student edition - how to register?

    Geoff Pearson, Aug 27, 2005, in forum: Computer Support
    Replies:
    2
    Views:
    422
    George H.
    Aug 27, 2005
  2. amirster

    Writing Register code in vhdl

    amirster, Jun 5, 2007, in forum: Hardware
    Replies:
    2
    Views:
    2,258
    asicvlsi
    Jun 11, 2007
  3. Giuen
    Replies:
    0
    Views:
    564
    Giuen
    Sep 12, 2008
  4. becool_nikks
    Replies:
    0
    Views:
    1,889
    becool_nikks
    Mar 6, 2009
  5. kapsy_27
    Replies:
    0
    Views:
    1,344
    kapsy_27
    Sep 9, 2011
Loading...

Share This Page