你好,我是 VHDL 编程的新手,请帮我解决这些错误
Hello,I am new to VHDL programming please help me out with these errors
我不知道为什么它显示错误,虽然语法似乎是正确的。
我不想编写 sramctl,其中地址 adds_in 是输入地址,sram_adds 输出地址我只是映射地址,没有考虑数据总线。
library IEEE;
use IEEE.std_logic_1164.all;
entity sramctrl is
port(clk,adsn,blastn,lwdrn,lhold:in std_logic;
adds_in :in std_logic_vector(9 downto 2);
adds_4msb:in std_logic_vector(31 downto 28);
readyn,btermn,sramcsn,sramoen,lholda :out std_logic;
sram_adds:out std_logic_vector(9 downto 2));
end sramctrl;
architecture behavioral of sramctrl is
type state_type is(s0,s1,s2);
signal state:state_type;
begin
process(clk,adsn,blastn,lwdrn,lhold,adds_in,adds_4msb)
begin
variable sa:std_logic:='0';
variable a31_a28 :std_logic_vector(3 downto 0):="0000";
variable temp:std_logic_vector(9 downto 2):="00000000";
if(rising_edge(clk))then
if ((not adsn) and (adds_4msb="0000"))then
a31_28 := adds_4msb;
end if;
if (lhold='1')then
lholda<='1';
else
lholda<='0';
end if;
sa:=lhold and lholda ;
case state is
when s0=>sramoen<='1';
sramcsn<='1';
readyn<='1';
btermn<='1';
if((not adsn) and (not adds_4msb) and sa)then
temp:=adds_in;
if(lwdrn='1')then
state<=s1;
ready<='0';
else
state<=s2;
end if;
else
state<=s0;
end if;
when s1=>sramoen<='1';
sramcsn<='0';
if(lwdrn and (not blastn) and sa)then
sram_adds<=temp;
readyn<='1';
btermn<='1';
state<=s0;
elsif(lwdrn and blastn and sa)then
if(temp=X"fe")then
sram_adds<=temp;
temp:=temp+1;
btermn<='0';
readyn<='0';
state<=s1;
elsif(temp=X"ff")then
sram_adds<=temp;
btermn<='1';
readyn<='1';
state<=s0;
else
sram_adds<=temp;
temp:=temp+1;
btermn<='1';
readyn<='0';
state<=s1;
end if;
else
state<=s2;
end if;
when s2=>sramoen<='0';
sramcsn<='0';
if((not lwdrn) and (not blastn) and sa)then
sram_adds<=temp;
readyn<='1';
btermn<='1';
state<=s0;
elsif((not lwdrn) and blastn and sa)then
if(temp=X"fe")then
sram_adds<=temp;
temp:=temp+1;
btermn<='0';
readyn<='0';
state<=s2;
elsif(temp=X"ff")then
sram_adds<=temp;
btermn<='1';
readyn<='1';
state<=s0;
else
sram_adds<=temp;
temp:=temp+1;
btermn<='1';
readyn<='0';
state<=s2;
end if;
else
state<=s2;
end if;
when others =>state<=s0;
end case;
end if;
end process;
end behavioral ;
我找不到解决办法,请帮帮我。它弹出的错误:
COMP96 Compile Architecture "behavioral" of Entity "sramctrl"
COMP96 ERROR COMP96_0019: "Keyword 'end' expected." "design.vhd" 18 9
COMP96 ERROR COMP96_0019: "Keyword 'end' expected." "design.vhd" 19 3
COMP96 ERROR COMP96_0016: "Design unit declaration expected." "design.vhd"
不,你的语法不正确。
正如阿米尔所说:
process(clk,adsn,blastn,lwdrn,lhold,adds_in,adds_4msb)
begin
variable sa:std_logic:='0';
variable a31_a28 :std_logic_vector(3 downto 0):="0000";
variable temp:std_logic_vector(9 downto 2):="00000000";
应该是:
process(clk,adsn,blastn,lwdrn,lhold,adds_in,adds_4msb)
variable sa:std_logic:='0';
variable a31_a28 :std_logic_vector(3 downto 0):="0000";
variable temp:std_logic_vector(9 downto 2):="00000000";
begin
begin
这里把流程声明部分和流程声明部分分开了。
此外,这里:
if ((not adsn) and (adds_4msb="0000"))then
没有 and
运算符对 std_logic 和布尔值(正确表达式的结果)进行与运算。not
不是逻辑归约运算符,它 returns a std_logic 在这种情况下。
应该是这样的:
if adsn = '0' and adds_4msb = "0000" then
对两个布尔结果进行 AND 运算。请注意 adds_4msb
.
的更正拼写
下一行:
a31_28 := adds_4msb;
有个拼写错误,应该是a31_a28.
这里::
if lhold = '1' then
lholda <= '1';
else
lholda <= '0';
end if;
sa := lhold and lholda ;
lholda
是一个输出,在某些不符合 IEEE Std 1076-2008 标准的工具中无法读取。它还会产生一个 sa
,它只是被一个 delta 模拟周期延迟(没有时间提前)并且除了 trim 在 holda
结束后的一个 delta 周期对于 [=25] 没有其他意义=] 或关闭 lhold
的开头。如果你指望那个三角洲循环不存在,那么你的设计就有缺陷。 Delta 循环模拟并行性,不应指望变量用于时序关系。这意味着您没有 sram_ctl 的符合条件的综合模型。 Synthesis 会将 lhold
和 lholda
视为同一事物,而 sa
会视为同一事物的不同名称。
这里:
ready<='0';
您的设计中没有信号 ready
。
并且:
if(lwdrn and (not blastn) and sa)then
以及:
elsif(lwdrn and blastn and sa)then
您正在尝试使用逻辑运算符生成布尔条件。 (所有这些括号也是多余的)尝试将两个表达式条件测试为 std_logic 值。
这两个条件各出现两个地方
并且:
temp:=temp+1;
没有直接可见的加法运算符“+”(两处)。您应该使用包 std_logic_unsigned 或 temp
应该是无符号的并且您应该使用包 numeric_std (分配给 sram_adds
时需要类型转换)。
我不知道为什么它显示错误,虽然语法似乎是正确的。
我不想编写 sramctl,其中地址 adds_in 是输入地址,sram_adds 输出地址我只是映射地址,没有考虑数据总线。
library IEEE;
use IEEE.std_logic_1164.all;
entity sramctrl is
port(clk,adsn,blastn,lwdrn,lhold:in std_logic;
adds_in :in std_logic_vector(9 downto 2);
adds_4msb:in std_logic_vector(31 downto 28);
readyn,btermn,sramcsn,sramoen,lholda :out std_logic;
sram_adds:out std_logic_vector(9 downto 2));
end sramctrl;
architecture behavioral of sramctrl is
type state_type is(s0,s1,s2);
signal state:state_type;
begin
process(clk,adsn,blastn,lwdrn,lhold,adds_in,adds_4msb)
begin
variable sa:std_logic:='0';
variable a31_a28 :std_logic_vector(3 downto 0):="0000";
variable temp:std_logic_vector(9 downto 2):="00000000";
if(rising_edge(clk))then
if ((not adsn) and (adds_4msb="0000"))then
a31_28 := adds_4msb;
end if;
if (lhold='1')then
lholda<='1';
else
lholda<='0';
end if;
sa:=lhold and lholda ;
case state is
when s0=>sramoen<='1';
sramcsn<='1';
readyn<='1';
btermn<='1';
if((not adsn) and (not adds_4msb) and sa)then
temp:=adds_in;
if(lwdrn='1')then
state<=s1;
ready<='0';
else
state<=s2;
end if;
else
state<=s0;
end if;
when s1=>sramoen<='1';
sramcsn<='0';
if(lwdrn and (not blastn) and sa)then
sram_adds<=temp;
readyn<='1';
btermn<='1';
state<=s0;
elsif(lwdrn and blastn and sa)then
if(temp=X"fe")then
sram_adds<=temp;
temp:=temp+1;
btermn<='0';
readyn<='0';
state<=s1;
elsif(temp=X"ff")then
sram_adds<=temp;
btermn<='1';
readyn<='1';
state<=s0;
else
sram_adds<=temp;
temp:=temp+1;
btermn<='1';
readyn<='0';
state<=s1;
end if;
else
state<=s2;
end if;
when s2=>sramoen<='0';
sramcsn<='0';
if((not lwdrn) and (not blastn) and sa)then
sram_adds<=temp;
readyn<='1';
btermn<='1';
state<=s0;
elsif((not lwdrn) and blastn and sa)then
if(temp=X"fe")then
sram_adds<=temp;
temp:=temp+1;
btermn<='0';
readyn<='0';
state<=s2;
elsif(temp=X"ff")then
sram_adds<=temp;
btermn<='1';
readyn<='1';
state<=s0;
else
sram_adds<=temp;
temp:=temp+1;
btermn<='1';
readyn<='0';
state<=s2;
end if;
else
state<=s2;
end if;
when others =>state<=s0;
end case;
end if;
end process;
end behavioral ;
我找不到解决办法,请帮帮我。它弹出的错误:
COMP96 Compile Architecture "behavioral" of Entity "sramctrl"
COMP96 ERROR COMP96_0019: "Keyword 'end' expected." "design.vhd" 18 9
COMP96 ERROR COMP96_0019: "Keyword 'end' expected." "design.vhd" 19 3
COMP96 ERROR COMP96_0016: "Design unit declaration expected." "design.vhd"
不,你的语法不正确。
正如阿米尔所说:
process(clk,adsn,blastn,lwdrn,lhold,adds_in,adds_4msb)
begin
variable sa:std_logic:='0';
variable a31_a28 :std_logic_vector(3 downto 0):="0000";
variable temp:std_logic_vector(9 downto 2):="00000000";
应该是:
process(clk,adsn,blastn,lwdrn,lhold,adds_in,adds_4msb)
variable sa:std_logic:='0';
variable a31_a28 :std_logic_vector(3 downto 0):="0000";
variable temp:std_logic_vector(9 downto 2):="00000000";
begin
begin
这里把流程声明部分和流程声明部分分开了。
此外,这里:
if ((not adsn) and (adds_4msb="0000"))then
没有 and
运算符对 std_logic 和布尔值(正确表达式的结果)进行与运算。not
不是逻辑归约运算符,它 returns a std_logic 在这种情况下。
应该是这样的:
if adsn = '0' and adds_4msb = "0000" then
对两个布尔结果进行 AND 运算。请注意 adds_4msb
.
下一行:
a31_28 := adds_4msb;
有个拼写错误,应该是a31_a28.
这里::
if lhold = '1' then
lholda <= '1';
else
lholda <= '0';
end if;
sa := lhold and lholda ;
lholda
是一个输出,在某些不符合 IEEE Std 1076-2008 标准的工具中无法读取。它还会产生一个 sa
,它只是被一个 delta 模拟周期延迟(没有时间提前)并且除了 trim 在 holda
结束后的一个 delta 周期对于 [=25] 没有其他意义=] 或关闭 lhold
的开头。如果你指望那个三角洲循环不存在,那么你的设计就有缺陷。 Delta 循环模拟并行性,不应指望变量用于时序关系。这意味着您没有 sram_ctl 的符合条件的综合模型。 Synthesis 会将 lhold
和 lholda
视为同一事物,而 sa
会视为同一事物的不同名称。
这里:
ready<='0';
您的设计中没有信号 ready
。
并且:
if(lwdrn and (not blastn) and sa)then
以及:
elsif(lwdrn and blastn and sa)then
您正在尝试使用逻辑运算符生成布尔条件。 (所有这些括号也是多余的)尝试将两个表达式条件测试为 std_logic 值。
这两个条件各出现两个地方
并且:
temp:=temp+1;
没有直接可见的加法运算符“+”(两处)。您应该使用包 std_logic_unsigned 或 temp
应该是无符号的并且您应该使用包 numeric_std (分配给 sram_adds
时需要类型转换)。