各位晚上好 . 我首先要说的是我对VHDL很新 . 我有一个项目要求我建模一个由摩托罗拉在VHDL(MC14510B为任何好奇的人)制作的更新计数器 .
从数据表可以看出,如果输入PE(预置使能)切换为高电平,则输入引脚p4 ... p1处的4个预置值将直接传递到输出q4 ... q1 .
出于某种原因,我的代码拒绝编译,抛出错误错误:COMP96_0143:MC14510B.vhd:(56,13):无法写入对象"p" . 我做错了 . 我不想写入输入,我想用q中存储的值写入qtemp .
谁能看到我搞砸了什么?在进程语句中,主if-else中的else语句是给我带来问题的(p <= qtemp行) . 任何帮助将非常感激 .
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.std_logic_unsigned.all;
entity MC14510B is
port (
signal pe : in std_logic;
signal ci_not : inout std_logic;
signal reset : in std_logic;
signal updown : in std_logic;
signal clk : in std_logic;
signal p : in std_logic_vector (3 downto 0);
signal q : out std_logic_vector(3 downto 0);
signal co_not : inout std_logic
);
end;
architecture myarch of MC14510B is
begin
process(pe, ci_not, reset, updown, clk)
variable qtemp : std_logic_vector(3 downto 0);
variable cotemp : std_logic;
begin
if reset = '1' then --reset condition
qtemp := "0000";
elsif clk'event and updown = '1' and ci_not = '1' then --count up
if qtemp < 15 then
qtemp := qtemp + 1;
cotemp := '1';
else
qtemp := "0000";
cotemp := '0';
end if;
elsif clk'event and updown = '0' and ci_not = '1' then --count down
if qtemp > 0 then
qtemp := qtemp - 1;
cotemp := '1';
else
qtemp := "0000";
cotemp := '0';
end if;
elsif ci_not = '0' then
qtemp := "1010";
cotemp := '1';
else
if pe = '1' then --enable preset
p <= qtemp; --output = input presets
cotemp := '1';
else
qtemp := qtemp; --output = output
cotemp := '1';
end if;
end if;
q <= qtemp;
co_not <= cotemp;
end process;
end myarch;
1 回答
你似乎有一个转让qtemp的任务转向你有
p := qtemp
并且应该有qtemp <= p
. 它看起来似乎应该在该过程的敏感性列表中 .然后你的代码分析 . 不保证它是正确的 .
p
是声明模式,你不能写它 .