数组 数组为同类型元素的有序排布(从左向 右),每一元素与一个数组指标对应; 数组指标通常为整数;也可以采用枚举类 型的元素来表达。 只有一维和二维数组可以综合,高维数组 不可综合;
数组 数组为同类型元素的有序排布(从左向 右),每一元素与一个数组指标对应; 数组指标通常为整数;也可以采用枚举类 型的元素来表达。 只有一维和二维数组可以综合,高维数组 不可综合;
数组示例 type byte is array (7 downto 0)of std logic; type monthly count is array(l to 12)ofinteger type length is array (natural range <>)of bit;
数组示例 type byte is array (7 downto 0) of std_logic; type monthly_count is array (1 to 12) of integer; type length is array (natural range <>) of bit;
数组示例 constant word len: integer: =32 type word is array (word len-l downto O)of std logic; constant num regs: integer: =8 type reg file is array (1 to num regs)of word;
数组示例 constant word_len: integer := 32; type word is array (word_len-1 downto 0)of std_logic; constant num_regs: integer := 8; type reg_file is array (1 to num_regs) of word;
多维数组定义的示例 type row is array (7 downto 0)of std logic 先定义一维数组; type matrix is array(0 to 3)of row; 再定义1x1数组; type matrix is array(0 to 3 )of std logic vector (7 downto0);-直接定义1x1数组; type matrix is array (0 to 3, 7 downto o)of std logic;-直接定义2维数组;
多维数组定义的示例 type row is array (7 downto 0) of std_logic; --先定义一维数组; type matrix is array (0 to 3) of row; --再定义1x1数组; type matrix is array (0 to 3) of std_logic_vector (7 downto 0); --直接定义1x1数组; type matrix is array (0 to 3,7 downto 0) of std_logic;--直接定义2维数组;
数据类型的转换 当数据需要交替进行算术和逻辑运算时,就需 要进行数据转换; 一般的类型转换通常由专门的函数进行,这些 函数存放在特定的包集合中 子类型与基本类型之间可以直接赋值,不需要 进行类型转换;个别非常关联的类型可以通过 赋值进行直接转换;
数据类型的转换 当数据需要交替进行算术和逻辑运算时,就需 要进行数据转换; 一般的类型转换通常由专门的函数进行,这些 函数存放在特定的包集合中; 子类型与基本类型之间可以直接赋值,不需要 进行类型转换;个别非常关联的类型可以通过 赋值进行直接转换;