0

各位晚上好。我首先要说我对 VHDL 很陌生。我有一个项目要求我为摩托罗拉用 VHDL 制作的倒数计数器建模(任何好奇的人都可以使用 MC14510B)。

从数据表可以看出,如果输入 PE(预设启用)切换为高电平,则输入引脚 p4...p1 处的 4 个预设值直接传递到输出 q4...q1。

由于某种原因,我的代码拒绝编译,抛出错误Error: COMP96_0143: MC14510B.vhd : (56, 13): Object "p" cannot be write。我正在使用 Aldec 作为编译器,但不知道我做错了什么。我不想将输入写入 p,我想将存储在 p 中的值写入 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;
4

1 回答 1

0

你似乎有一个 qtemp 的任务在你有p := qtemp和应该有的地方转过来qtemp <= p。看起来 p 应该在该过程的敏感度列表中。

然后您的代码进行分析。不保证它在其他方面是正确的。

p被声明为模式,你不能写它。

于 2015-02-05T05:00:41.463 回答