【发布时间】:2016-04-21 00:46:39
【问题描述】:
我需要您的帮助来修复我的 vhdl 代码中的一些错误。我正在使用fpga优势5.2,它太旧了,但是我因为框图而使用它,而不是自己编写代码。我正在使用vhdl开发mips处理器,我已经完成了除了两个块之外的所有块,它们是数据内存和指令内存。两个块都有相同的错误:
数据内存错误:
错误:C:/单周期处理器/处理器/hdl/dmem_untitled.vhd(34): “是”附近:期待:开始错误:C:/单周期 处理器/处理器/hdl/dmem_untitled.vhd(51):靠近“进程”: 期待:';'
指令内存错误:
错误:C:/单周期处理器/处理器/hdl/imem_untitled.vhd(38): “是”附近:期待:开始错误:C:/单周期 处理器/处理器/hdl/imem_untitled.vhd(53):在“进程”附近: 期待:';'
这里是数据存储器的代码:
-- 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;
【问题讨论】:
标签: vhdl