我是一名学习VHDL的学生,并且有一个非常基本的问题.
我已经读过,信号分配不会立即发生.所以以下内容不会按预期工作:
x <= y;
z <= not x;
Run Code Online (Sandbox Code Playgroud)
所以我理解分配不是立即/不按顺序发生,但我有一个关于将信号传递给实体的问题.假设我有以下代码:
architecture struct of mips is
begin
controller: entity work.controller port map(opD => instrD(31 downto 26),
functD => instrD(5 downto 0));
datapath: entity work.dataPath port map(opD => instrD(31 downto 26),
functD => instrD(5 downto 0));
end;
Run Code Online (Sandbox Code Playgroud)
我习惯于尝试避免代码重复和其他语言的硬编码,因此上面代码中的硬编码opD和functD值很困扰我.
我想知道的是,如果我可以将这些值分配给内部信号,如下所示:
architecture struct of mips is
signal opD: STD_LOGIC;
signal functD: STD_LOGIC;
begin
signal opD <= instrD(31 downto 26);
signal functD <= instrD(5 downto 0);
controller: entity work.controller port map(opD …Run Code Online (Sandbox Code Playgroud) 我在组合分配方面遇到了麻烦.我不明白为什么我不能使用总是组合结构设置我的输出变量.当我使用assign时,我没有得到赋值错误.
我认为分配和总是@(*)都意味着阻止(组合分配)
module control_unit(input wire [31:0] instruction
,output wire RegDst
,output wire ALUSrc
,output wire RegWrite
,output wire MemRead
,output wire MemWrite
,output wire MemToReg
,output wire Branch
);
wire [5:0] opcode;
assign opcode = instruction[31:26];
always@(*) begin
case(opcode)
6'b000000: begin // r-type
RegDst = 1'b1;
ALUSrc = 1'b0;
RegWrite = 1'b1;
MemRead = 1'b0;
MemWrite = 1'b0;
MemToReg = 1'b0;
Branch = 1'b0;
end
.
.
.
default: begin
RegDst = 1'b0;
ALUSrc = 1'b0;
RegWrite = 1'b0;
MemRead …Run Code Online (Sandbox Code Playgroud) 我写了一些关于使用全加器作为组件的 8 位加法器的代码。当我开始编译时,它显示了一个我无法找到的错误。我可能还有其他我无法注意到的错误。这是我的代码:
library ieee;
use ieee.std_logic_1164.all;
entity F_A is
port(
a,b,c_in : in std_logic;
sum,c_out : out std_logic);
end F_A;
architecture behave of F_A is
begin
sum <= a xor b xor c_in;
c_out <= (a and b)or(a and c_in)or(b and c_in);
end behave;
entity Adder_8bit is
port( a,b: in std_logic_vector(7 downto 0);
Cin: in std_logic;
sum: out std_logic_vector(7 downto 0);
Cout: out std_logic);
end Adder_8bit;
architecture RTL of Adder_8bit is
signal c : std_logic_vector(7 downto 0);
component F_A …Run Code Online (Sandbox Code Playgroud) 以下VHDL将用于测试工作台.在分析期间,我在第一个等待语句中一直出现错误:"wait语句必须包含带有UNTIL关键字的条件子句"我有几个以这种方式编写的工作测试平台.我似乎无法找到错误可能是什么.
`library IEEE;
USE IEEE.std_logic_1164.all;
entity case_ex_TB is end;
architecture simple_test of case_ex_TB is
--- DUT Component Declaration ---
component case_ex
port(
clk, rstN: IN std_logic;
color: OUT std_logic_vector(2 downto 0));
end component;
--- Signals Declaration ---
signal rst, clock: std_logic:='0';
signal color: std_logic_vector(2 downto 0);
begin
DUT: case_ex --- DUT instantiation ---
port map (clk => clock,
rstN => rst,
color => color);
--- Signal's Waves Creation ---
rst <= '1','0' after 50 ns, '1' after 2 us;
clock_crtate: …Run Code Online (Sandbox Code Playgroud) 我对 VHDL 中的一个问题感到困惑。
我做了一个VGA_display_ characters,所以我想std_logic_vectors通过to_integer无符号将一些转换为整数,然后我想恢复,这样我就不能同时使用这些库了。
ieee.std_logic_arith.all和ieee.numeric_std.all
quartus 给出的错误:
(错误(10621):interface.vhd(34)处的VHDL使用条款错误:不止一个使用条款导入了一个简单名称“无符号”的声明——没有一个声明是直接可见的错误(10784):syn_arit处的HDL错误.vhd(26):请参阅我的代码下方的对象“无符号”声明: