小编use*_*739的帖子

通过泛型来记录端口类型

我最近开始使用记录作为我的端口定义,特别是如果我想对属于某个接口的信号进行分组.但是,我在这里遇到的问题是我无法通过泛型传递给stl_logic_vector的宽度.所以我基本上想做的是以下内容:

library ieee;
use ieee.std_logic_1164.all;
use work.math_pkg.all;

package fifo_pkg is

  type fifo_in_type is record
    data_in : std_logic_vector(DATA_WIDTH_??- 1 downto 0);
    rd      : std_logic;
    wr      : std_logic;
  end record;

  type fifo_out_type is record
    data_out : std_logic_vector(DATA_WIDTH_?? - 1 downto 0);
    empty    : std_logic;
    full     : std_logic;
  end record;

  component fifo is
    generic
      (
        MIN_DEPTH  : integer;
        DATA_WIDTH : integer
        );
    port
      (
        clk   : in  std_logic;
        res_n : in  std_logic;
        i     : in  fifo_in_type;
        o     : out fifo_out_type
        );
  end component …
Run Code Online (Sandbox Code Playgroud)

vhdl

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

标签 统计

vhdl ×1