?? 數(shù)據(jù)類型知識(shí)點(diǎn).vhd
字號(hào):
type byte is array (7 downto 0 )of std_logic;--一維數(shù)組
type mem1 is array (0 to 3,7 downto 0)of std_logic;--二維數(shù)組
type mem2 is array (0 to 3)of byte;--1*1維數(shù)組 4個(gè)矢量,每個(gè)矢量的位寬
--為8
type mem1 is array (0 to 3)of std_logic_vector(0 to 7);--1*1維數(shù)組
signal a: std_logic;--標(biāo)量信號(hào)
signal b: bit;--標(biāo)量信號(hào)
signal x: byte;--一維信號(hào)
signal y: std_logic_vector(7 downto 0);--一維信號(hào)
signal v: bit_vector(3 downto 0);--一維信號(hào)
signal z: std_logic_vector(x 'high downto 0 );--一維信號(hào)
signal w1:mem1;--二維信號(hào)
signal w2:mem2;--1*1維信號(hào)
signal w3:mem3;--1*1維信號(hào)
----------------合法的標(biāo)量賦值----------------------------
x(2) <= 2; --同類型(std_logic),使用正確
y(0) <= x(0); --同類型(std_logic),使用正確
z(7) <= x(5); --同類型(std_logic),使用正確
b <=v (3); --同類型(bit),使用正確
w1(0,0) <= x(3); --同類型(std_logic),使用正確
w1(2,5) <= y(7); --同類型(std_logic),使用正確
w2(0) (0) <= x(2); --同類型(std_logic),使用正確
w2(2) (5) <= y(7); --同類型(std_logic),使用正確
w1(2,5) <=w2(3)(7); --同類型(std_logic),使用正確
------------非法的標(biāo)量賦值-----------------------
b <=a; --bit和std_logic時(shí)數(shù)據(jù)類型不匹配
w1(0)(2) <=x(2); ----------w1的索引項(xiàng)必須是二維的
w2(2,0) <=a-;------------w2的索引項(xiàng)必須是1*1維的
--------------合法的矢量賦值-----------------
x <= "11111110";
y <= ('1' '1' '1' '1' '1' '1' '0' 'z' );
z <= "11111"&"000";
x <= (others => '1');
y <=(7=>'0', 1=>'0', others =>'1');
z <= y;
y(2 downto 0) <= z(6 downto 4);
w2(0)(7 downto 0) <="11110000";
w3(1) <= (others => '0');
w2 <=((others => '0'),(others => '0'),(others => '0'),(others => '0'));
w3 <=("11111100",('0' '0' '0' '0' 'z' 'z' 'z' 'z' ),(others => '0'),(others => '0'));
w1 <=((others => 'z'),"11110000","11110000",(others => '0'));
----------對(duì)數(shù)組進(jìn)行初始化的一個(gè)實(shí)例-------------
for i in 0 to 3 loop;
for j in 7 downto 0 loop
x(j) <= '0';
y(j) <= '0';
z(j) <= '0';
w1(i,j) <='0';
w2(i)(j) <='0';
w3(i)(j) <='0';
end loop;
end loop;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -