我是VHDL的新手并且在尝试将 Map 移植到地面时遇到了问题 .
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity msPC4 is
Port ( b : in STD_LOGIC_VECTOR (3 downto 0);
clk : in STD_LOGIC;
reset : in STD_LOGIC;
a : out STD_LOGIC_VECTOR (3 downto 0);
co : out STD_LOGIC);
end msPC4;
architecture Structure of msPC4 is
component msdff4
Port ( d : in STD_LOGIC_VECTOR (3 downto 0);
clk : in STD_LOGIC;
q : out STD_LOGIC_VECTOR (3 downto 0));
end component;
component msFA4bit
Port ( a : in STD_LOGIC_VECTOR (3 downto 0);
b : in STD_LOGIC_VECTOR (3 downto 0);
ci : in STD_LOGIC;
s : out STD_LOGIC_VECTOR (3 downto 0);
co : out STD_LOGIC);
end component;
component ms21mux4
Port ( d1 : in STD_LOGIC_VECTOR (3 downto 0);
d0 : in STD_LOGIC_VECTOR (3 downto 0);
s : in STD_LOGIC;
z : out STD_LOGIC_VECTOR (3 downto 0));
end component;
signal w0, w1, w2, w3: STD_LOGIC_VECTOR (3 downto 0);
signal w4 : STD_LOGIC;
w4 <= '0';
w3 <= '0000';
begin
gmsPC4g1: msdff4 port map (w1,clk,w2);
gmsPC4g2: msFA4bit port map (w2,b,w4,w0,co);
gmsPC4g3: ms21mux4 port map (w0,w3,clk,w1);
a <= w2;
end Structure;
因此,如果您注意到,我有3个组件,一对信号连接所有等等 .
我真正想要的是,信号w3和w4被设置为接地(与逻辑低电平相连,但是无论如何),我不能为我的生活弄清楚我应该如何做到这一点 .
FWIW I 'm an EE so I'更习惯于从硬件端看到这一点 . 此外,这个项目必须完成端口映射而不是行为的东西 . 对于那个很抱歉 .
编辑:错误是在w3设置为'0'的行中抛出,w4设置为'0000' . 双引号不能解决此错误 . 将其移入内部开始并不能解决错误 . 在开始集中,我得到了一个“意外收视”,在开始集之外,我得到了一个“意想不到的标识符” . 它真的不想让我决定某事物的 Value .
1 回答
更改代码:
允许成功分析,注意
w4
或w3
没有其他驱动程序 .或者,您可以在声明中提供默认值:
这也分析了 .
默认值表示信号分配之前的信号值 .
您还可以直接提供值:
这个分析 .
或提供常数值:
这也分析了 .
请注意字符串文字值(
"0000"
)中使用的双引号 . 单引号(刻度)用于具有图形表示的字符文字 .您没有使用包std_logic_arith和std_logic_unisigned . 他们的使用条款是多余的 .