Определение объекта VHDL - PullRequest
0 голосов
/ 26 мая 2020

Я использую несколько ресурсов на inte rnet для изучения дизайна процессора и материнской платы, и я обнаружил ошибку: VHDL: Синтаксическая ошибка близка к концу. Я новичок в этом и не могу точно определить причину. Любая помощь будет принята с благодарностью.

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

entity ROM is
port (
    ADDR : in std_logic_vector (31 downto 0);
    D_IN : in std_logic_vector (63 downto 0);
    D_OUT : out std_logic_vector (63 downto 0);
    CLK : in std_logic;
    WE : in std_logic;
    EN : out std_logic
)
end ROM;

architecture rom_arch of ROM is

    constant INVALID_DATA : std_logic_vector (63 downto 0) := (others => 'X');
    subtype DATA_ROM_WORD is std_logic_vector (63 downto 0);
    type DATA_ROM_TABLE is array (0 to (2**3)-1) of DATA_ROM_WORD;
    signal DATA_ROM : DATA_ROM_TABLE := DATA_ROM_TABLE'
    ( 
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000") --NOP
    );

begin

    process ( ADDR, CLK, WE ) is
    begin
        if ADDR <= X"FF" and CLK = '1'
        then
            EN <= '1';
            D_OUT <= DATA_ROM(conv_integer(ADDR));
            if WE='1'
            then
                DATA_ROM(conv_integer(ADDR)) <= D_IN;
            end if;
            EN <= '0';
        end if;
    end process;

end rom_arch;

1 Ответ

0 голосов
/ 26 мая 2020

В конце отсутствует точка с запятой. Всегда проверяйте эту пунктуацию.

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

entity ROM is
port (
    ADDR : in std_logic_vector (31 downto 0);
    D_IN : in std_logic_vector (63 downto 0);
    D_OUT : out std_logic_vector (63 downto 0);
    CLK : in std_logic;
    WE : in std_logic;
    EN : out std_logic
);
end ROM;

architecture rom_arch of ROM is

    constant INVALID_DATA : std_logic_vector (63 downto 0) := (others => 'X');
    subtype DATA_ROM_WORD is std_logic_vector (63 downto 0);
    type DATA_ROM_TABLE is array (0 to (2**3)-1) of DATA_ROM_WORD;
    signal DATA_ROM : DATA_ROM_TABLE := DATA_ROM_TABLE'
    ( 
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000"), --NOP
        DATA_ROM_WORD'("0000000000000000000000000000000000000000000000000000000000000000") --NOP
    );

begin

    process ( ADDR, CLK, WE ) is
    begin
        if ADDR <= X"FF" and CLK = '1'
        then
            EN <= '1';
            D_OUT <= DATA_ROM(conv_integer(ADDR));
            if WE='1'
            then
                DATA_ROM(conv_integer(ADDR)) <= D_IN;
            end if;
            EN <= '0';
        end if;
    end process;

end rom_arch;
...