【发布时间】:2018-11-07 06:41:25
【问题描述】:
为Parallel-in,Parallel-out右移编写一个VHDL模块 图的寄存器(附),但添加一个低电平有效的异步 清除信号 ClrN。不要在代码中使用单独的触发器。 对模块进行仿真,得到类似图的时序图 (附上)。
请使用下列参数生成波形。
-设置 ClrN = 1 用于 3.5 个时钟周期,= 0 用于下半个时钟周期,= 1 用于测试休息。
-设置 L = 1 用于 5 个时钟周期,= 0 用于接下来的 3 个时钟周期,= 1 用于其余测试
-设置 SI = 1
-设置 D = 0101
-设置 Sh = 0 用于 1 个时钟周期,= 1 用于接下来的 5 个时钟周期,= 0 用于其余测试
提交演示您的操作的仿真波形 代码。
我收到错误[Synth 8-1789] cannot update 'in' object dout
我尝试了以下方法:
library ieee;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
entity insertname is
port (
SI, Clk, ClrN, Sh, L : in std_logic;
Din : in std_logic_vector (3 downto 0);
SO : out std_logic;
Dout : std_logic_vector (3 downto 0)
);
end entity insertname;
architecture behavioral of insertname is
signal temp: std_logic_vector (3 downto 0) := "0000";
begin
process (Clk, ClrN)
begin
if ClrN = '0' then
temp <= x"0";
elsif Clk'event and Clk = '1' and Sh = '1' then
temp <= SI & temp(3 downto 1);
SO <= temp(0);
elsif Clk'event and Clk = '1' and Sh = '0' and L = '1' then
temp <= Din;
elsif Clk'event and Clk='1' and Sh='0' and L='0' then
temp <= temp;
end if;
end process;
Dout <= temp;
end behavioral;
【问题讨论】:
-
linked figures 来自逻辑设计基础第 6 版。 Charles H. Roth, Jr. 和 Larry L. Kinney,第 360-361 页。请注意,您已经制作了一个单独的触发器。您还可以将图 12.10 (b) 中触发器前面所示的多路复用器表示为内部 if 语句。您不需要在顺序元素(寄存器、触发器)中为自身分配值。注意表 12-1 没有显示它。从图 12-10(b) 看,你的班次分配不正确。