Skip to content

Instantly share code, notes, and snippets.

@ikwzm
Created March 19, 2015 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikwzm/67bb0279bbfd3d449e4e to your computer and use it in GitHub Desktop.
Save ikwzm/67bb0279bbfd3d449e4e to your computer and use it in GitHub Desktop.
VHDL の2次元配列のサンプル
library ieee;
use ieee.std_logic_1164.all;
package TYPES is
constant WORD_BITS : integer := 8;
subtype WORD_TYPE is std_logic_vector(WORD_BITS-1 downto 0);
type WORD_WINDOW is array(integer range <>, integer range <>) of WORD_TYPE;
end TYPES;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use WORK.TYPES.all;
entity VEC2 is
port (
A : in WORD_WINDOW(0 to 3, 0 to 3);
B : in WORD_WINDOW(0 to 3, 0 to 3);
O : out WORD_WINDOW(0 to 3, 0 to 3)
);
end VEC2;
architecture RTL of VEC2 is
begin
process(A,B) begin
for x in 0 to 3 loop
for y in 0 to 3 loop
O(x,y) <= std_logic_vector(unsigned(A(x,y)) + unsigned(B(x,y)));
end loop;
end loop;
end process;
end RTL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment