Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / vhdl_json / vhdl_files / 2-exportOK / ghdl / ghdl / testsuite / gna / bug040 / izigzag_index.vhd @ 2051e520

History | View | Annotate | Download (1.66 KB)

1
library ieee;
2
use ieee.std_logic_1164.all;
3

    
4

    
5
library ieee;
6
use ieee.numeric_std.all;
7

    
8
entity izigzag_index is
9
	port (
10
		clk : in  std_logic;
11
		ra0_addr : in  std_logic_vector(5 downto 0);
12
		ra0_data : out std_logic_vector(5 downto 0)
13
	);
14
end izigzag_index;
15
architecture augh of izigzag_index is
16

    
17
	-- Embedded RAM
18

    
19
	type ram_type is array (0 to 63) of std_logic_vector(5 downto 0);
20
	signal ram : ram_type := (
21
		"000000", "000001", "001000", "010000", "001001", "000010", "000011", "001010", "010001", "011000", "100000", "011001",
22
		"010010", "001011", "000100", "000101", "001100", "010011", "011010", "100001", "101000", "110000", "101001", "100010",
23
		"011011", "010100", "001101", "000110", "000111", "001110", "010101", "011100", "100011", "101010", "110001", "111000",
24
		"111001", "110010", "101011", "100100", "011101", "010110", "001111", "010111", "011110", "100101", "101100", "110011",
25
		"111010", "111011", "110100", "101101", "100110", "011111", "100111", "101110", "110101", "111100", "111101", "110110",
26
		"101111", "110111", "111110", "111111"
27
	);
28

    
29

    
30
	-- Little utility functions to make VHDL syntactically correct
31
	--   with the syntax to_integer(unsigned(vector)) when 'vector' is a std_logic.
32
	--   This happens when accessing arrays with <= 2 cells, for example.
33

    
34
	function to_integer(B: std_logic) return integer is
35
		variable V: std_logic_vector(0 to 0);
36
	begin
37
		V(0) := B;
38
		return to_integer(unsigned(V));
39
	end;
40

    
41
	function to_integer(V: std_logic_vector) return integer is
42
	begin
43
		return to_integer(unsigned(V));
44
	end;
45

    
46
begin
47

    
48
	-- The component is a ROM.
49
	-- There is no Write side.
50

    
51
	-- The Read side (the outputs)
52

    
53
	ra0_data <= ram( to_integer(ra0_addr) );
54

    
55
end architecture;