2016-04-21 77 views
0

我需要你的帮助来修复我的vhdl代码中的一些错误。我正在使用fpga优势5.2,它太旧了,但我使用它是因为框图,而不是用自己编写代码。我正在开发使用vhdl的mips处理器,我已经完成除了两个块之外的所有块,这些块是数据内存和指令内存。这两个块具有相同的错误:使用fpga的VHDL代码错误

数据内存错误:

ERROR: C:/Single-cycle processor/Processor/hdl/dmem_untitled.vhd(34): near "is": expecting: BEGIN ERROR: C:/Single-cycle processor/Processor/hdl/dmem_untitled.vhd(51): near "process": expecting: ';'

指令存储器的错误:

ERROR: C:/Single-cycle processor/Processor/hdl/imem_untitled.vhd(38): near "is": expecting: BEGIN ERROR: C:/Single-cycle processor/Processor/hdl/imem_untitled.vhd(53): near "process": expecting: ';'

这里是对数据存储的代码:

-- hds header_start 
-- 
-- VHDL Architecture Processor.dmem.untitled 
-- 
-- Created: 
--   by - Ahmed.UNKNOWN (AHMED-PC) 
--   at - 01:58:50 04/21/2016 
-- 
-- Generated by Mentor Graphics' HDL Designer(TM) 2001.5 (Build 170) 
-- 
-- hds header_end 
library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.NUMERIC_STD.all; 

use IEEE.STD_LOGIC_SIGNED.all; 
use IEEE.STD_LOGIC_ARITH.all; 
use IEEE.std_logic_textio.all; 
library STD; 
use STD.textio.all; 


ENTITY dmem IS 
-- Declarations 
port(clk, we: in STD_LOGIC; 
a, wd: in STD_LOGIC_VECTOR (15 downto 0); 
rd: out STD_LOGIC_VECTOR (15 downto 0)); 

END dmem ; 

-- hds interface_end 
ARCHITECTURE untitled OF dmem IS 
BEGIN 
process is 
    type ramtype is array (63 downto 0) of STD_LOGIC_VECTOR(15 downto 0); 
    variable mem: ramtype; 
    variable IADR: INTEGER; 

    begin 

    IADR:= CONV_INTEGER(a(7 downto 2)); 
    -- read or write memory 
    --loop 
     if rising_edge(clk) then 
      if (we='1') then mem (IADR):= wd; 
      end if; 
     end if; 
     rd <= mem (IADR); 
     wait on clk, a; 
    --end loop; 
end process; 

END untitled; 

而且指令存储器的代码:

-- hds header_start 
-- 
-- VHDL Architecture Processor.IMEM.untitled 
-- 
-- Created: 
--   by - Ahmed.UNKNOWN (AHMED-PC) 
--   at - 02:17:30 04/21/2016 
-- 
-- Generated by Mentor Graphics' HDL Designer(TM) 2001.5 (Build 170) 
-- 
-- hds header_end 
library IEEE; 
use IEEE.STD_LOGIC_1164.all; 
use IEEE.STD_LOGIC_SIGNED.all; 
use IEEE.STD_LOGIC_ARITH.all; 

use IEEE.std_logic_textio.all; 
library STD; 
use STD.textio.all; 



ENTITY IMEM IS 
-- Declarations 

    port(

    rd: out STD_LOGIC_VECTOR(31 downto 0); 
    a: in STD_LOGIC_VECTOR(5 downto 0) 
    ); 

END IMEM ; 

    -- hds interface_end 
    ARCHITECTURE untitled OF IMEM IS 
    begin 

    ROM_PROCESS: process(a) is 
             type MEM is array(0 to 63) of STD_LOGIC_VECTOR(31 downto 0); 
             variable MEMORY: MEM := (others => X"00000000"); 
             variable IADR: INTEGER; 

    begin 
      memory(0) := X"00611820" ; -- add $3, $3, $1 
      memory(1) := X"ac030004" ; -- sw $3, 4($0) 
      memory(2) := X"00221024" ; -- and $2,$1,$2 
      memory(3) := X"10220001" ; -- beq $1, $2, SAME 
      memory(4) := X"8c010004" ; -- lw $1, 4($0) 
      memory(5) := X"0022182a" ; -- SAME: slt $3, $1, $2 
      IADR:= CONV_INTEGER(a); 
      rd <= MEMORY(IADR); 

     end process; 

    END untitled; 

回答

1

进程语句中的is从IEEE Std 1076-1993转发是可选的,但在-1987原始版本的VHDL标准中不允许。

在处理敏感度列表后的两个文件中删除is。这告诉我们你正在用符合-1987的工具分析VHDL(用于综合?)。

另请注意,您的使用条款是一团糟。软件包numeric_std不应该与Synopsys软件包std_logic_arith或std_logic_unsigned一起使用。你可以简单地评论一下使用条款。

有一个隐含的库子句使得库逻辑名std可用,你不需要这样做。你也没有使用textio。

您的代码将使用符合-1993修订版的VHDL工具进行分析。

+0

谢谢你的帮助 – ahmed