标签: vhdl

如何比较整数和 std_logic 向量

我有一系列信号。当作为“选择器”的信号等于单元格编号时,我想写入数组中的适当单元格。为了节省编写和代码行,我在生成循环中生成分配:

read_data_signals_gen: for i in 0 to (CAU_num -1) generate

    v_direction_sig(i)(0) <=  DATA_IN when (chosen_flow_sig = i) and (read_state = st_read_v_direction_0) else
                              v_direction_sig(i)(0);
    v_direction_sig(i)(1) <=  DATA_IN when (chosen_flow_sig = i) and (read_state = st_read_v_direction_1) else
                              v_direction_sig(i)(1);
    v_direction_sig(i)(2) <=  DATA_IN when (chosen_flow_sig = i) and (read_state = st_read_v_direction_2) else
                              v_direction_sig(i)
  ...
end generation read_data_signals_gen;
Run Code Online (Sandbox Code Playgroud)

selected_flow_sig 是一个std_logic_vector (1 downto 0)和 gets "00""01""10""11"表示单元格的编号,并且CAU_num是一个integer等于 4的常数。如何在when语句中创建比较,以便整数将等于其二进制转换?

还有一个相关的问题。有没有办法执行以下代码:

type  BitArray is …
Run Code Online (Sandbox Code Playgroud)

vhdl

1
推荐指数
1
解决办法
2万
查看次数

是否可以在其中合成带有变量的 VHDL 代码

如果我的VHDL 中有变量,它是否可以综合(使用RTL编译器等软件)?

我对此表示怀疑,因为它会立即更改其值。我现在在用std_logic

vhdl hdl

1
推荐指数
1
解决办法
1865
查看次数

VHDL 中的上升沿是否可合成

在我编写此语句时的编码中,它是模拟的,但不可综合。为什么?现在我该怎么做才能解决这个问题???

IF ((DS0='1' OR DS1='1')and rising_edge(DS0) and rising_edge(DS1) AND DTACK='1' AND BERR='1') THEN
RV0 <= not RV;
else
RV0 <= RV;
Run Code Online (Sandbox Code Playgroud)

vhdl

1
推荐指数
1
解决办法
666
查看次数

vhdl std_logic未声明错误

我一直收到没有声明std_logic的烦人的错误。我不知道为什么会收到此错误,因为我已包含所有必需的库。这是我的代码和错误。

     ---------------------------------------------------------------------    -------------
          -- Company: 
          -- Engineer: 
          -- 
-- Create Date:    15:26:41 08/23/2015 
-- Design Name: 
-- Module Name:    Deficit-Round_Robbin_algorithem - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description: 
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
package TwoDArray is
  Type array_integer is …
Run Code Online (Sandbox Code Playgroud)

vhdl

1
推荐指数
1
解决办法
7305
查看次数

VHDL结构

大家好,任何人都可以帮我解决VHDL问题.我正在尝试一些实用的结构编程,并希望从一个简单的半加法器开始.继承我的代码

LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
Run Code Online (Sandbox Code Playgroud)

--XOR DESCRITION

entity xor_2 is
    port (a, b : in std_logic;
        f : out std_logic );
end xor_2;

Architecture func of xor_2 is
begin
    f <= a xor b;
end func;
Run Code Online (Sandbox Code Playgroud)

- 和说明

entity and_2 is
    port (a, b : in std_logic;
            f : out std_logic);
end and_2;

architecture func of and_2 is
begin
    f1 <= a and b;
end func;
Run Code Online (Sandbox Code Playgroud)

--HALF ADDER DESCRIPTION

entity struct_1 is
    port ( a, b : in std_logic;
            s, …
Run Code Online (Sandbox Code Playgroud)

vhdl hdl

1
推荐指数
1
解决办法
222
查看次数

二维无约束 Nx1 阵列

我正在尝试创建一个灵活的常量数组。我想使用二维数组,有时可能是例如 2x1、2x2、3x2 数组等。例如:

type int_2d_array is array (integer range<>, integer range<>) of integer;
constant M : positive := 2;
constant nMax : positive := 1;
constant n : int_2d_array(M - 1 downto 0, nMax - 1 downto 0) := ( (1) , (2) ); -- wrong

error: type int_2d_array does not match with the integer literal
Run Code Online (Sandbox Code Playgroud)

如果我这样做,它不会抱怨:

type int_2d_array is array (integer range<>, integer range<>) of integer;
constant M : positive := 2;
constant nMax : positive := 2;
constant …
Run Code Online (Sandbox Code Playgroud)

arrays vhdl

1
推荐指数
1
解决办法
232
查看次数

VHDL中conv_integer的使用

我正在尝试编写一些代码,这些代码只会向左或向右移动 32 位向量,其中 5 位输入将用于移位量 ( shamt)。我遇到的问题是试图将 an 转换std_logic_vectorinteger. 我的代码是这样的:

library ieee;
use ieee.STD_LOGIC_1164.all;
use ieee.STD_LOGIC_ARITH.all;

entity shiftlogical is
  port(x     : in  std_logic_vector(31 downto 0);
       shamt : in  std_logic_vector( 4 downto 0);
       y     : out std_logic_vector(31 downto 0));
end shiftlogical;

architecture beh of shiftlogical is
  signal shift : integer;
  signal temp  : std_logic_vector(31 downto 0);
begin
  shift <= conv_integer(unsigned(shamt));
  temp  <= x(shift downto 0);
  y     <= temp;
end beh;
Run Code Online (Sandbox Code Playgroud)

我知道代码不完整,但为了测试一些想法,我试图将"00010"(2)传递到 中shamt,但结果是 …

vhdl

1
推荐指数
1
解决办法
6973
查看次数

正在处理端口映射的替代方法?

就我对 vhdl 的理解而言,不可能将端口映射到进程内的组件。我很好奇是否有其他方法来处理条件场景。

这是我目前正在处理的计算器 vhdl 代码示例:

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;


-- OP CODE TABLE --
-- 00   :   LOAD --
-- 01   :   ADD/SUB  --
-- 10   :   Print--
-- 11   :   BEQ  --

-- li - RS Values --
-- 00 : R0 --
-- 01 : R1 --
-- 10 : R2 --
-- 11 : R3 --


-- //      add     | op, rs, rd, rt       //
-- //      sub     | op, rs, rd, rt       // …
Run Code Online (Sandbox Code Playgroud)

vhdl

1
推荐指数
1
解决办法
5501
查看次数

如何在 vhdl 中将信号延迟几个时钟周期

我试图将信号延迟五个时钟周期..

 process (read_clk)
begin
if (rising_edge(read_clk)) then
    rd_delay <= rd_en;
end if;
end process;

delay3 <= not(rd_en) and rd_delay;
Run Code Online (Sandbox Code Playgroud)

通过边缘检测技术,这会给我一个时钟周期的延迟,但我需要五个时钟周期。

谢谢你们。

vhdl

1
推荐指数
1
解决办法
5226
查看次数

VHDL 错误(10482)对象 std_logic_vector 已使用但未声明

我写了一些关于使用全加器作为组件的 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)

compiler-errors vhdl quartus

1
推荐指数
1
解决办法
3018
查看次数

标签 统计

vhdl ×10

hdl ×2

arrays ×1

compiler-errors ×1

quartus ×1