我想要一个简单的模块,添加两个std_logic_vectors.但是,当使用下面的代码和+运算符时,它不会合成.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
entity add_module is
port(
pr_in1 : in std_logic_vector(31 downto 0);
pr_in2 : in std_logic_vector(31 downto 0);
pr_out : out std_logic_vector(31 downto 0)
);
end add_module;
architecture Behavior of add_module is
begin
pr_out <= pr_in1 + pr_in2;
end architecture Behavior;
Run Code Online (Sandbox Code Playgroud)
我从XST得到的错误消息
第17行.+在这种情况下不能有这样的操作数.
我想念图书馆吗?如果可能,我不想将输入转换为自然数.
非常感谢
我有四个std_logic_vectors(15 downto 0)并希望将它们堆叠成一个std_logic_vector(63 downt 0)所以我已经找到了一种方法,但它是正确的方式还是有更优化和正确的方法来做到这一点?
signal slv16_1,slv16_2,slv16_3,slv16_4 : std_logic_vector(15 downto 0);
signal slv64 : std_logic_vector(63 downto 0);
slv64(15 downto 0) <= slv16_1;
slv64(31 downto 16) <= slv16_2;
slv64(47 downto 32) <= slv16_3;
slv64(63 downto 48) <= slv16_4;
Run Code Online (Sandbox Code Playgroud) 我试图理解或研究verilog中ASIC设计的最佳实践.我正在开发一个中等大小的块,有大约20个子模块(每行〜1000行代码).手动实例化所有子模块并进行端口连接以创建顶级RTL是一项艰苦的工作.
我想编写一个脚本来自动执行此操作.只要我们可以定义所有子模块的输入/输出以及每个子模块如何相互连接,自动生成顶层就不会太难了.但我在设计自动化方面没有足够的专业知识.我想知道是否有人可以给我一些关于如何开始的指示.
我非常感谢任何形式的意见或建议.
在VHDL中,'字符可以用于封装字符标记ie '.',也可以用作属性分隔符(类似于CPP的:: token)ie string'("hello").
解析包含字符的属性名称时会出现此问题ie string'('a','b','c').在这种情况下,一个天真的词法分析器会错误地将第'('一个标记为一个字符,并且所有下面的实际字符都将被搞砸.
从2007年开始comp.lang.vhdl google group中有一个帖子,它提出了一个类似的问题,题为" Lexing the'char ",其中有一个用户diogratia的答案
Run Code Online (Sandbox Code Playgroud)case '\'': /* IR1045 check */ if ( last_token == DELIM_RIGHT_PAREN || last_token == DELIM_RIGHT_BRACKET || last_token == KEYWD_ALL || last_token == IDENTIFIER_TOKEN || last_token == STR_LIT_TOKEN || last_token == CHAR_LIT_TOKEN || ! (buff_ptr<BUFSIZ-2) ) token_flag = DELIM_APOSTROPHE; else if (is_graphic_char(NEXT_CHAR) && line_buff[buff_ptr+2] == '\'') { CHARACTER_LITERAL: buff_ptr+= 3; /* lead,trailing \' and char */ last_token = CHAR_LIT_TOKEN; …
在VHDL中测试简单的生活游戏实现时,在打印出“测试结束”消息后,空测试台的GHDL模拟会挂起,CPU使用率达到100%。
这是代码:
----- Package ------------------------------
library ieee;
use ieee.std_logic_1164.all;
package data_types is
type array2D is array (0 to 10, 0 to 10) of std_logic;
end data_types;
----- Main Code ----------------------------
library ieee;
use ieee.std_logic_1164.all;
use work.data_types.all;
entity de0 is
port (matrix : inout array2D);
end de0;
architecture life of de0 is
-- Return the integer value of a cell, treating all out of bounds as 0
function cellValue (matrix : array2D; x, y : integer) return integer is
begin
if …Run Code Online (Sandbox Code Playgroud) cmd_register: process (rst_n, clk)
begin
if (rst_n='0') then
cmd_r<= (others=>'0');
elsif (clk'event and clk='1') then
cmd_r<=...;
end if;
end process cmd_register;
Run Code Online (Sandbox Code Playgroud)
我知道"<="指定分配但是什么others?那怎么=>办?
我有一个VHDL程序,我不能用GHDL来详细说明,因为要详细说明的实体是在一个包中.如何使用GHDL在包中详细说明实体?
编辑:
谢谢你的答案,经过一段时间我发现包中的代码就像一个接口,我们应该自己实现这个组件,我错误地认为它是完整的.抱歉错误的问题,我是VHDL的新手,我正在学习绳索,因为我的假设是错误的,所以无法在谷歌上找到任何解释.
我写了一些vhdl代码,其中包含半加法器的实现.这是几行代码,没有错误.
当我用ghdl编译它时,它会生成.o相应vhdl文件的文件.但是当我执行时ghdl -e filename,会发生以下错误:
*error: cannot find entity or configuration demo*
*/usr/lib/ghdl/bin/ghdl: compilation error*
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?提前致谢
出于教育目的,我试图声明一个字符文字的枚举值的别名.在下面的示例中,我正在尝试bit_one在枚举类型bit(在std.standard中声明)中为值"1" 创建别名.
我很疑惑为什么下面的第一个表格被两个编译器(GHDL 0.29.1和Quartus II 13.01)拒绝,而第二个表单被同样的两个,以及ModelSim和ActiveHDL接受.因此,问题是:在下面的注释掉的行中声明这个别名是非法的吗?
entity character_literal_alias is
end;
architecture rtl of character_literal_alias is
--alias bit_one is '1'[return bit]; -- Doesn't work in GHDL or Quartus
alias bit_one is std.standard.'1'[return bit]; -- Works with ModelSim, ActiveHDL, GHDL, and Quartus
alias append is append_mode[return file_open_kind]; -- Works with the whole bunch
begin
end;
Run Code Online (Sandbox Code Playgroud)
我在其他工具中使用GHDL和VHDL-2008中的VHDL-2002开关.
如果我稍微推测一下,在VHDL-2008 LRM中,所有示例都是以下列形式编写的:
-- implicit aliases ...
-- alias '0' is STD.STANDARD.'0' [return STD.STANDARD.BIT];
-- alias '1' is STD.STANDARD.'1' [return STD.STANDARD.BIT]; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Peter Ashenden的书"VHDL的设计者指南"来学习VHDL,但似乎无法摆脱我错过了与敏感性列表相关的基本项目的感觉.
例如,一个问题是"编写一个表示具有整数输入和输出的简单ALU的模型,以及一个类型为bit的函数选择输入.如果函数选择为'0',则ALU输出应该是输入的总和,否则输出应该是输入的差异."
我的解决方案是
entity ALU is
port (
a : in integer; -- A port
b : in integer; -- B port
sel : in bit; -- Fun select
z : out integer); -- result
end entity ALU;
architecture behav of ALU is
begin -- architecture behav
alu_proc: process is
variable result : integer := 0;
begin -- process alu_proc
wait on sel;
if sel = '0' then
result := a + b;
else
result := a - b; …Run Code Online (Sandbox Code Playgroud) vhdl ×9
fpga ×3
ghdl ×3
alias ×1
automation ×1
enumeration ×1
flex-lexer ×1
grammar-kit ×1
if-statement ×1
process ×1
verilog ×1