如果我有一个采用泛型类型的VHDL package或function,那么是否有办法在泛型类型上调用image属性(或者以其他方式实现相同的功能)?
例如,如果我试图用Modelsim编译这个包:
package dummy_pkg is
generic (type pkg_t);
end package;
package body dummy_pkg is
procedure do_something(x : pkg_t) is
constant s : string := pkg_t'image(x);
begin
end
我希望替换Verilog模块()中的一些通用同步代码。代码是一个标准的2触发器同步器.
always @ (posedge clk_i or posedge rst)
begin
if (rst)
begin
rx_sync_tmp <= 1'b1;
rx_sync <= 1'b1;
end
else
begin
rx_sync_tmp <= rx_i;
rx_sync <= rx_sync_tmp;
end
end
VHDL中的实体声明也很简单:
e
在任何版本的VHDL中,可能在2008年,在声明之前使用某种类型吗?
例如,在实体的体系结构中有一个数组声明:
type my_array is array (integer range <>) of my_type;
仍然在相同的体系结构部分,但在后面的文件中,我有以下内容:
type my_type is record
my_field: signed(31 downto 0);
end record;
现在,这在Vivado中产生了以下错误:
未声明Synth 8-1031 my_type
当然,解决方案是将记录声明移到数组声明的上方。然而,随着类型数量的增
关于如何在VHDL和SystemVerilog之间传递2D数组的文档似乎很少。我在VHDL中有以下类型的端口:
package my_package is
type my_array_t is array (natural range <>) of std_logic_vector(N-1 downto 0);
end my_package
entity my_entity is
port(
my_input : in my_array_t(M-1 downto 0);
my_output : out my_array_t(M-
我需要实施几个并行的进程。我对vhdl非常陌生,不知道如何在没有实体的情况下构建体系结构?我真的需要一个实体作为架构吗?
architecture architecture_test of ????? is
shared variable test: std_ulogic_vector(7 downto 0);
process1 : process is
begin
-- do something
end process process1;
process2 : process is
begin
--do something
end process proc
我有一个VHDL包,它定义一个函数(前向声明)和一个常量。常数的值由该函数计算,该函数的主体位于包体中。
到目前为止,ModelSim/QuestaSim是唯一不喜欢这段代码的工具。它需要两个包,所以在常量声明之前对主体进行了解析。
package test is
function mytest(param : boolean ) return boolean;
constant value : boolean := mytest(TRUE);
end package;
package body test is
function mytest(param : boolean )
我只需在旧模块中检查一些内容,并找到以下实体声明:
entity myOldModule is
port
(
clk: in std_logic;
reset: in std_logic;
data: in std_logic;
valid: std_logic;
...
);
end myOldModule;
注意有效端口声明中缺少的in。在高级模块中的组件声明中也缺少它。不过,它确实按预期的方式编译和运行。所以我的问题是:
( a)为什么VHDL语法允许这样做?我认为端口列表语法是:port_name: mode data_typ
我有一个问题,为什么接口中的成员变量不能是非常数..静态的逻辑就站在我的脑海里,如果一个人需要访问Interface的变量,那么它必须是静态的,因为我们不能创建Interface的实例,但是为什么需要final呢?下面的代码显示了如何将接口成员变量设为static final,尽管我们在默认情况下没有提到它。
interface inter{
int a=10; // It becomes final static by default
public void interFunc();
}
class cls implements inter{
我是VHDL的新手。在我的一项任务中,我需要使用VHDL实现状态表方法中的状态机。因此,我为架构实体编写了以下代码:
X,Y是输入位,这是摩尔机器,它接受两个输入,输出一个比特。
architecture Table of SM1_2 is
type StateTable is array(integer range<>,bit range<>,bit range<>) of integer;
type OutTable is array(integer range<>) of bit;
signal State,NextSta
我在设计单端口rom到斯巴达6板时遇到了一些麻烦。我使用提供的内核生成器来创建块内存,并选择32位宽、256深的单端口rom和一个从0到255的coe文件。我将rom作为组件放入我的vhdl中,并将XilinxCoreLib作为库添加。当我尝试生成编程文件时,我得到了翻译错误:
logical block 'rom1' with type 'rom' could not be
resolved. A pin name misspelling can cause this, a missing edif or ngc file,
case mismatch bet
这个问题涉及到定义一个可以接受参数化长度数组的模块的能力。
我目前拥有的是:
use work.my_types.all;
entity Calc is
port (clk : in std_logic;
y1, y2, yc, y3, y4 : in u8exrow;
lap_l, lap_r : out s9row) ;
end Calc;
其中类型u8exrow和s9row是在my_types包中定义的数组。
我希望这些数组的长度可以通过使用泛型来改变。
例如,这是不允许的(因为它不使用类型,所以不
是否可以为记录类型或一般任何用户定义的类型定义默认值? 类似于(伪VHDL): type t_foo is record
a : integer := 4;
b : std_logic := '0';
end record; 或 subtype glarp is integer range 0 to 10 := 5; 编辑:将glarp从类型定义更改为子类型定义。
我当时正在读,它清楚地说明了One significant difference between classes and interfaces is that classes can have fields whereas interfaces cannot.怎么可能这样做,因为Java也表示all fields in interface are public,static and final。
根据以下链接,java堆栈帧包含局部变量、操作数堆栈和当前类常量池引用。
也来自Oracle "Structure of JVM“第2.6.3节。“动态链接-每个框架(§2.6)都包含对当前方法类型的运行时常数池(§2.5.5)的引用,以支持方法代码的动态链接。”
我还了解到堆中的对象也有指向类数据的指针/引用。
堆栈帧将包含“当前类常量池引用”,它还将具有对堆中对象的引用,而堆中的对象也将指向类数据。这不是多余的吗??
例如。
public class Honda {
public void run() {
System.out.println("honda is
我是VHDL的初学者。我正在使用GHDL来实现我的VHDL代码并对其进行测试。我为XOR Gate写了一个简单的VHDL行为代码。我正在尝试编写一个测试平台来测试XOR Gate。 XOR VHDL代码: library ieee;
use ieee.std_logic_1164.all;
entity XORGate is
port(
xora, xorb : in std_logic;
xorout : out std_logic
);
end XORGate;
architecture behave of XORGate is
begin
process(xo
在vhdl中,我可以定义自己的枚举类型并创建这种类型的信号:
type tp is (red,green,blue,yellow);
signal sg: tp := red;
但是现在我想要一个for循环来运行所有这些状态。有点像
for i in sg'min to sg'max loop
<something>
end loop;
在c++中有用于此目的的迭代器。但在VHDL中,我所能找到的只有sg'pos,它将信号转换为我可以增加的数字。但我似乎找不到办法把数字转换成信号。
在下面的代码中,我收到以下错误,但我不明白为什么是错误。
library ieee;
use ieee.std_logic_1164.all;
entity RGSTR_SHFT_N_PARAL_B2 is
Generic (
n: integer := 4
);
port(
DATA : in std_logic_vector((n-1) downto 0);
Shift_In : in std_logic;
Load : in std_logic;
Enable : in std_logic;
CLK : in
具有从定义的VHDL子类型
signal ShortInt: integer range 0 to 255;
subtype SHORT integer range 0 to 255;
我是否会像这样使用short:
signal ShortInt: SHORT;
为什么我不把范围放在信号上,完全省略掉子类型呢?
signal ShortInt: integer range 0 to 255;
我在这里看到了关于子类型及其用途的问题,但我还没有找到像我这样头脑简单的人,为什么要使用子类型呢?
这个问题一直困扰着我。我迫不及待地想听到他们的回应。我经常看到这样的情况
public interface Istuff
{
public static final int STATE_B = 4;
public static final int STATE_L = 5;
public static final int STATE_U = 6;
}
还有这一张
public class MyStuffConstants
{
public static final String STATUS = "STATUS";
public stati