OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [hf-risc/] [platform/] [virtex4_ml403/] [virtex4ml403.vhd] - Blame information for rev 13

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_unsigned.all;
4
 
5
entity hellfire_cpu_if is
6
        generic(
7
                address_width: integer := 16;
8
                memory_file : string := "code.txt";
9
                uart_support : string := "yes"
10
        );
11
        port (  clk_in:         in std_logic;
12
                reset_in:       in std_logic;
13
                uart_read:      in std_logic;
14
                uart_write:     out std_logic
15
        );
16
end hellfire_cpu_if;
17
 
18
architecture interface of hellfire_cpu_if is
19
        signal clock, reset, boot_enable, ram_enable_n, stall, stall_cpu, busy_cpu, irq_cpu, irq_ack_cpu, data_access_cpu, ram_dly: std_logic;
20
        signal address, data_read, data_write, data_read_boot, data_read_ram, irq_vector_cpu, inst_addr_cpu, inst_in_cpu, data_addr_cpu, data_in_cpu, data_out_cpu: std_logic_vector(31 downto 0);
21
        signal ext_irq: std_logic_vector(7 downto 0);
22
        signal data_we, data_w_n_ram, data_w_cpu: std_logic_vector(3 downto 0);
23
begin
24
        reset <= not reset_in;
25
 
26
        -- clock divider (50MHz clock from 100MHz main clock for ML403 kit)
27
        process (reset, clk_in, clock)
28
        begin
29
                if reset = '1' then
30
                        clock <= '0';
31
                else
32
                        if clk_in'event and clk_in='1' then
33
                                clock <= not clock;
34
                        end if;
35
                end if;
36
        end process;
37
 
38
        -- reset synchronizer
39
        process (clock, reset_in)
40
        begin
41
                if (reset_in = '0') then
42
                        rff1 <= '1';
43
                        reset <= '1';
44
                elsif (clock'event and clock = '1') then
45
                        rff1 <= '0';
46
                        reset <= rff1;
47
                end if;
48
        end process;
49
 
50
        process(clk_in, reset, ram_enable_n)
51
        begin
52
                if reset = '1' then
53
                        ram_dly <= '0';
54
                elsif clk_in'event and clk_in = '1' then
55
                        ram_dly <= not ram_enable_n;
56
                end if;
57
        end process;
58
 
59
        ext_irq <= "00000000";
60
 
61
        stall <= '0';
62
        boot_enable <= '1' when address(31 downto 28) = "0000" else '0';
63
        ram_enable_n <= '0' when address(31 downto 28) = "0100" else '1';
64
        data_read <= data_read_boot when address(31 downto 28) = "0000" and ram_dly = '0' else data_read_ram;
65
        data_w_n_ram <= not data_we;
66
 
67
        -- HF-RISC core
68
        core: entity work.datapath
69
        port map(       clock => clock,
70
                        reset => reset,
71
                        stall => stall_cpu,
72
                        busy => busy_cpu,
73
                        irq_vector => irq_vector_cpu,
74
                        irq => irq_cpu,
75
                        irq_ack => irq_ack_cpu,
76
                        inst_addr => inst_addr_cpu,
77
                        inst_in => inst_in_cpu,
78
                        data_addr => data_addr_cpu,
79
                        data_in => data_in_cpu,
80
                        data_out => data_out_cpu,
81
                        data_w => data_w_cpu,
82
                        data_access => data_access_cpu
83
        );
84
 
85
        -- peripherals / busmux logic
86
        peripherals_busmux: entity work.busmux
87
        generic map(
88
                uart_support => uart_support
89
        )
90
        port map(
91
                clock => clock,
92
                reset => reset,
93
 
94
                stall => stall,
95
 
96
                stall_cpu => stall_cpu,
97
                busy_cpu => busy_cpu,
98
                irq_vector_cpu => irq_vector_cpu,
99
                irq_cpu => irq_cpu,
100
                irq_ack_cpu => irq_ack_cpu,
101
                inst_addr_cpu => inst_addr_cpu,
102
                inst_in_cpu => inst_in_cpu,
103
                data_addr_cpu => data_addr_cpu,
104
                data_in_cpu => data_in_cpu,
105
                data_out_cpu => data_out_cpu,
106
                data_w_cpu => data_w_cpu,
107
                data_access_cpu => data_access_cpu,
108
 
109
                addr_mem => address,
110
                data_read_mem => data_read,
111
                data_write_mem => data_write,
112
                data_we_mem => data_we,
113
                extio_in => ext_irq,
114
                extio_out => open,
115
                uart_read => uart_read,
116
                uart_write => uart_write
117
        );
118
 
119
        -- instruction and data memory (boot RAM)
120
        boot_ram: entity work.ram
121
        generic map (memory_type => "DEFAULT")
122
        port map (
123
                clk                     => clock,
124
                enable                  => boot_enable,
125
                write_byte_enable       => "0000",
126
                address                 => address(31 downto 2),
127
                data_write              => (others => '0'),
128
                data_read               => data_read_boot
129
        );
130
 
131
        -- instruction and data memory (external RAM)
132
        memory0lb: entity work.bram
133
        generic map (   memory_file => memory_file,
134
                                        data_width => 8,
135
                                        address_width => address_width,
136
                                        bank => 0)
137
        port map(
138
                clk     => clock,
139
                addr    => address(address_width -1 downto 2),
140
                cs_n    => ram_enable_n,
141
                we_n    => data_w_n_ram(0),
142
                data_i  => data_write(7 downto 0),
143
                data_o  => data_read_ram(7 downto 0)
144
        );
145
 
146
        memory0ub: entity work.bram
147
        generic map (   memory_file => memory_file,
148
                                        data_width => 8,
149
                                        address_width => address_width,
150
                                        bank => 1)
151
        port map(
152
                clk     => clock,
153
                addr    => address(address_width -1 downto 2),
154
                cs_n    => ram_enable_n,
155
                we_n    => data_w_n_ram(1),
156
                data_i  => data_write(15 downto 8),
157
                data_o  => data_read_ram(15 downto 8)
158
        );
159
 
160
        memory1lb: entity work.bram
161
        generic map (   memory_file => memory_file,
162
                                        data_width => 8,
163
                                        address_width => address_width,
164
                                        bank => 2)
165
        port map(
166
                clk     => clock,
167
                addr    => address(address_width -1 downto 2),
168
                cs_n    => ram_enable_n,
169
                we_n    => data_w_n_ram(2),
170
                data_i  => data_write(23 downto 16),
171
                data_o  => data_read_ram(23 downto 16)
172
        );
173
 
174
        memory1ub: entity work.bram
175
        generic map (   memory_file => memory_file,
176
                                        data_width => 8,
177
                                        address_width => address_width,
178
                                        bank => 3)
179
        port map(
180
                clk     => clock,
181
                addr    => address(address_width -1 downto 2),
182
                cs_n    => ram_enable_n,
183
                we_n    => data_w_n_ram(3),
184
                data_i  => data_write(31 downto 24),
185
                data_o  => data_read_ram(31 downto 24)
186
        );
187
 
188
end interface;
189
 

powered by: WebSVN 2.1.0

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