我必须设计一个状态机,仅将NAND门用于组合部分,将D触发器用于顺序逻辑。一切都应以1GHz / 53的时钟频率运行。
现在,在您以“我们不会为您做功课”殴打我之前,让我告诉您,我花了几天的工作就报废了所有东西,然后又开始更严格地做所有事情。我想自己做,但是在项目的最简单部分中,我不断收到随机的,未定义的信号,这令人沮丧。
好的,首先,我有下图所示的状态机和真值表:
接下来是kmap:
由于对于D个触发器D = Q +,组合逻辑的布线(一旦将其构建到简化的块中)应该不会太难。
但是我的第一个问题出现在Q3 +的测试台上。为了简化信息,我在这里放一个我为Q3 +放在一起的快速图表:
在后面的文章中,您将看到在VHDL中,我实际上将输入in1Q3plus命名为in11Q3plus(11个输入),因为这不是最后一个块(最终的组合逻辑块由四个Q3 +,Q2 +,Q1 +,Q0 +块组成发出信号)。
因此,我必须使用NAND门来制作所有东西,这意味着我必须采用结构化方法。每个门基本上都基于NAND门,然后会增加复杂性(但是从AND门结构上只能写入AND,OR和NOT门)。然后,我有一个具有3个输入的“或”门,一个具有3个输入的“与”门和具有5个输入的“或”门(类似于逻辑图示例),每一个都基于先前的2个输入“与与”门。
直到Q3plus的每个测试台(上图)都可以工作。我的测试过程是为每个输入生成信号,以便可以在“模拟”窗口中方便地观看信号。例如,对于3输入与门,我具有以下信号:
process
begin
a1 <= '0' ; wait for 4ns;
a1 <= '1' ; wait for 4ns;
end process;
process
begin
b1 <= '0' ; wait for 8ns;
b1 <= '1' ; wait for 8ns;
end process;
process
begin
c1 <= '0' ; wait for 2ns;
c1 <= '1' ; wait for 2ns;
end process;
连接看起来像这样:
u1:ANDgate3 port map(A=>a1, B=>b1, C=>c1, fand3=>q1 );
因此,当我要模拟Q3plus测试台时会出现问题。在测试信号上,以2ns的周期从0翻转到1似乎似乎有一个错误,这是最不值得期待的。我将在此处发布测试台的代码,再次说明所有其他门测试台均正常运行:
library ieee;
use ieee.std_logic_1164.all;
entity Q3plusTEST is
end Q3plusTEST;
architecture behavior of Q3plusTEST is
component Q3plus is
port(outQ3plus: out std_Logic;
in1Q3plus: in std_Logic;
in2Q3plus: in std_Logic;
in3Q3plus: in std_Logic;
in4Q3plus: in std_Logic;
in5Q3plus: in std_Logic;
in6Q3plus: in std_Logic;
in7Q3plus: in std_Logic;
in8Q3plus: in std_Logic;
in9Q3plus: in std_Logic;
in10Q3plus: in std_Logic;
in11Q3plus: in std_Logic);
end component;
signal a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11, outsignal: std_logic;
begin
process
begin
a1<= '0'; wait for 4ns;
a1<= '1'; wait for 4ns;
end process;
process
begin
a2<= '0'; wait for 6ns;
a2<= '1'; wait for 6ns;
end process;
process
begin
a3<= '0'; wait for 8ns;
a3<= '1'; wait for 8ns;
end process;
process
begin
a4<= '0'; wait for 10ns;
a4<= '1'; wait for 10ns;
end process;
process
begin
a5<= '0'; wait for 12ns;
a5<= '1'; wait for 12ns;
end process;
process
begin
a6<= '0'; wait for 14ns;
a6<= '1'; wait for 14ns;
end process;
process
begin
a7<= '0'; wait for 16ns;
a7<= '1'; wait for 16ns;
end process;
process
begin
a8<= '0'; wait for 18ns;
a8<= '1'; wait for 18ns;
end process;
process
begin
a9<= '0'; wait for 20ns;
a9<= '1'; wait for 20ns;
end process;
process
begin
a10<= '0'; wait for 22ns;
a10<= '1'; wait for 22ns;
end process;
process
begin
a1<= '0'; wait for 24ns;
a1<= '1'; wait for 24ns;
end process;
U1: Q3plus port map(in1Q3plus=> a1, in2Q3plus=>a2, in3Q3plus=>a3, in4Q3plus=>a4, in5Q3plus=>a5, in6Q3plus=>a6, in7Q3plus=>a7, in8Q3plus=>a8, in9Q3plus=>a9, in10Q3plus=>a10, in11Q3plus=>a11, outQ3plus=> outsignal); end behavior;
实际的Q3plus块的代码是:
library ieee;
use ieee.std_logic_1164.all;
entity Q3plus is
port(outQ3plus: out std_Logic;
in1Q3plus: in std_Logic;
in2Q3plus: in std_Logic;
in3Q3plus: in std_Logic;
in4Q3plus: in std_Logic;
in5Q3plus: in std_Logic;
in6Q3plus: in std_Logic;
in7Q3plus: in std_Logic;
in8Q3plus: in std_Logic;
in9Q3plus: in std_Logic;
in10Q3plus: in std_Logic;
in11Q3plus: in std_Logic);
end Q3plus;
architecture behavior of Q3plus is
component ORgate5 is
port(AOR5: in std_logic;
BOR5: in std_logic;
COR5: in std_logic;
DOR5: in std_logic;
EOR5: in std_logic;
f5or: out std_logic);
end component;
component ANDgate3 is
port(A: in std_logic;
B: in std_logic;
C: in std_logic;
fand3: out std_logic);
end component;
component ANDgate is
port(xand: in std_logic;
yand: in std_logic;
fand: out std_logic);
end component;
signal z1,z2,z3,z4,z5: std_logic;
begin
U1: ANDgate port map(xand=> in1Q3plus, yand=> in2Q3plus, fand=> z1);
U2: ANDgate port map(xand=> in3Q3plus, yand=> in4Q3plus, fand=> z2);
U3: ANDgate port map(xand=> in5Q3plus, yand=> in6Q3plus, fand=> z3);
U4: ANDgate port map(xand=> in7Q3plus, yand=> in8Q3plus, fand=> z4);
U5: ANDgate3 port map(A=> in9Q3plus, B=> in10Q3plus, C=> in11Q3plus, fand3=> z5);
-- urmeaza toate portile de mai sus conectate la OR5
U6: ORgate5 port map(AOR5=>z1, BOR5=> z2, COR5=> z3, DOR5=> z4, EOR5=> z5, f5or=> outQ3plus);
end behavior;
测试台产生以下结果:
如您所见,第一个信号有一些奇怪的行为,第二个信号正常,最后一个信号完全不确定。当然,最终信号,即输出,是有缺陷的。
我的简单问题是:如何跟踪信号开始损坏的位置?在这种混乱的程序中,我感觉像个傻瓜,我真的很想完成这个。预先感谢您的任何回复。
18ns
它在VHDL标准中特别非法,但仍将保持这种状态。有两个独立的词汇元素抽象文字18
和标识符ns
。参见IEEE Std 1076-2008 15.3词法元素,分隔符和定界符,第11段。4-“...。在标识符或抽象文字与相邻的标识符或抽象文字之间至少需要一个分隔符”。您可能已经在等待语句中使用增量时间将刺激编写为一个过程。它可能直接指向了非驱动信号。