OpenCores
URL https://opencores.org/ocsvn/igor/igor/trunk

Subversion Repositories igor

[/] [igor/] [trunk/] [processor/] [mc/] [toplevel_tb.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 atypic
library ieee;
2
use ieee.std_logic_1164.all;
3
use work.leval_package.all;
4
use work.avremu_package.all;
5
 
6
entity toplevel_tb is
7
end entity;
8
 
9
architecture rtl of toplevel_tb is
10
 
11
-- COMPONENTS FOR THIS TEST
12
 
13
component avremu is
14
  port (
15
    data  : inout databus_t;            -- Data bus
16
    addr  : in    addr_t;               -- Address bus
17
    intr  : in    std_logic;            -- Interrupt line
18
    read  : in    std_logic;            -- Read signal
19
    write : in    std_logic;            -- Write signal
20
    rdy   : out   std_logic);           -- Ready flag
21
end component avremu;
22
 
23
component ext_mem is
24
        port(
25
                we : in std_logic;
26
                re : in std_logic;
27
                a : in std_logic_vector(ADDR_SIZE - 1 downto 0);
28
                d : inout std_logic_vector(WORD_SIZE - 1 downto 0);
29
                ce : in std_logic
30
        );
31
end component;
32
 
33
component toplevel is
34
        port(
35
                clk : in std_logic;
36
                rst_low : in std_logic;
37
                fpga_data : inout std_logic_vector(WORD_SIZE - 1 downto 0);
38
                fpga_addr : out std_logic_vector(ADDR_SIZE - 1 downto 0);
39
                avr_irq : out std_logic;
40
                avr_rdy : in  std_logic;
41
                sync : in std_logic;
42
                read : out std_logic;
43
                write : out std_logic;
44
                mem_ce : out std_logic;
45
                led : out std_logic_vector(7 downto 0);
46
                err : in std_logic_vector(1 downto 0));
47
end component;
48
 
49
 
50
signal dut_clk : std_logic := '1';
51
signal dut_rst : std_logic := '1';
52
signal iobus : std_logic_vector(WORD_SIZE - 1 downto 0);
53
signal ioaddr : std_logic_vector(ADDR_SIZE - 1 downto 0);
54
signal interrupt : std_logic;
55
signal rdy : std_logic; -- FROM AVR
56
signal sync : std_logic := '1'; -- FROM AVR
57
signal read : std_logic; -- TO MEM/AVR
58
signal write : std_logic; --  To mem/avr
59
signal mem_ce : std_logic; -- To mem
60
signal leds : std_logic_vector(7 downto 0);
61
 
62
 
63
-- Architecture begin
64
begin
65
 
66
        -----------------------------------------------------------------------------
67
        -- Design under test
68
        -----------------------------------------------------------------------------
69
        dut : toplevel
70
        port map (
71
                clk => dut_clk,
72
                rst_low => dut_rst,
73
                fpga_data => iobus,
74
                fpga_addr => ioaddr,
75
                avr_irq => interrupt,
76
                avr_rdy => rdy,
77
                sync => sync,
78
                read => read,
79
                write => write,
80
                mem_ce => mem_ce,
81
                led =>  leds,
82
                err => "00"
83
        );
84
 
85
        -----------------------------------------------------------------------------
86
        -- Support units
87
        -----------------------------------------------------------------------------
88
 
89
        -- The AVR
90
        -----------------------------------------------------------------------------
91
        iounit : avremu
92
        port map (
93
                data => iobus,
94
                addr => ioaddr(7 downto 0),
95
                intr => interrupt,
96
                read => read,
97
                write => write,
98
                rdy => rdy
99
        );
100
 
101
        -- External memory
102
        -----------------------------------------------------------------------------
103
        memory : ext_mem
104
        port map(
105
                we => write,
106
                re => read,
107
                a => ioaddr,
108
                d => iobus,
109
                ce => mem_ce
110
        );
111
 
112
        -- Clock generator
113
        -----------------------------------------------------------------------------
114
        clock_gen : process(dut_clk)
115
        begin
116
                if dut_clk = '1' then
117
                        dut_clk <= '0' after 5 ns, '1' after 10 ns;
118
                end if;
119
        end process;
120
end architecture;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.