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

Subversion Repositories leros

[/] [leros/] [trunk/] [vhdl/] [top/] [leroscyc12.vhd] - Blame information for rev 4

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

Line No. Rev Author Line
1 3 martin
--
2
--  Copyright 2011 Martin Schoeberl <masca@imm.dtu.dk>,
3
--                 Technical University of Denmark, DTU Informatics. 
4
--  All rights reserved.
5
--
6
-- Redistribution and use in source and binary forms, with or without
7
-- modification, are permitted provided that the following conditions are met:
8
-- 
9
--    1. Redistributions of source code must retain the above copyright notice,
10
--       this list of conditions and the following disclaimer.
11
-- 
12
--    2. Redistributions in binary form must reproduce the above copyright
13
--       notice, this list of conditions and the following disclaimer in the
14
--       documentation and/or other materials provided with the distribution.
15
-- 
16
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
17
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
-- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19
-- NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
-- 
27
-- The views and conclusions contained in the software and documentation are
28
-- those of the authors and should not be interpreted as representing official
29
-- policies, either expressed or implied, of the copyright holder.
30
-- 
31
 
32
--
33
--      leroscyc12.vhd
34
--
35
--      top level for cycore board with EP1C12
36
--
37
--      2011-02-20      creation
38
--
39
--
40
 
41
 
42
library ieee;
43
use ieee.std_logic_1164.all;
44
use ieee.numeric_std.all;
45
 
46
use work.leros_types.all;
47
 
48
 
49
entity leros_top is
50
 
51
generic (
52
        ram_cnt         : integer := 2          -- clock cycles for external ram
53
);
54
 
55
port (
56
        clk             : in std_logic;
57
--
58
--      serial interface
59
--
60
        ser_txd                 : out std_logic;
61
        ser_rxd                 : in std_logic;
62
        ser_ncts                : in std_logic;
63
        ser_nrts                : out std_logic;
64
 
65
--
66
--      watchdog
67
--
68
        wd              : out std_logic;
69
        freeio  : out std_logic;
70
 
71
--
72
--      two ram banks
73
--
74
--      rama_a          : out std_logic_vector(17 downto 0);
75
--      rama_d          : inout std_logic_vector(15 downto 0);
76
--      rama_ncs        : out std_logic;
77
--      rama_noe        : out std_logic;
78
--      rama_nlb        : out std_logic;
79
--      rama_nub        : out std_logic;
80
--      rama_nwe        : out std_logic;
81
--      ramb_a          : out std_logic_vector(17 downto 0);
82
--      ramb_d          : inout std_logic_vector(15 downto 0);
83
--      ramb_ncs        : out std_logic;
84
--      ramb_noe        : out std_logic;
85
--      ramb_nlb        : out std_logic;
86
--      ramb_nub        : out std_logic;
87
--      ramb_nwe        : out std_logic;
88
 
89
--
90
--      I/O pins of board
91
--
92
        io_b    : inout std_logic_vector(10 downto 1);
93
        io_l    : inout std_logic_vector(20 downto 1);
94
        io_r    : inout std_logic_vector(20 downto 1);
95
        io_t    : inout std_logic_vector(6 downto 1)
96
);
97
end leros_top;
98
 
99
architecture rtl of leros_top is
100
 
101
 
102
        signal clk_int                  : std_logic;
103
 
104
        -- for generation of internal reset
105
        signal int_res                  : std_logic;
106
        signal res_cnt                  : unsigned(2 downto 0) := "000"; -- for the simulation
107
 
108
        attribute altera_attribute : string;
109
        attribute altera_attribute of res_cnt : signal is "POWER_UP_LEVEL=LOW";
110
 
111
        signal wd_out                   : std_logic;
112
 
113
        signal ioout : io_out_type;
114
        signal ioin : io_in_type;
115
 
116
        signal outp                     : std_logic_vector(15 downto 0);
117
 
118
begin
119
 
120
        -- let's go for 200 MHz ;-)
121
        -- but for now 100 MHz is enough
122
        pll_inst : entity work.pll generic map(
123
                multiply_by => 5, -- shall be 5 for 100 MHz
124
                divide_by => 1
125
        )
126
        port map (
127
                inclk0   => clk,
128
                c0       => clk_int
129
        );
130
 
131
--
132
--      internal reset generation
133
--      should include the PLL lock signal
134
--
135
 
136
process(clk_int)
137
begin
138
        if rising_edge(clk_int) then
139
                if (res_cnt/="111") then
140
                        res_cnt <= res_cnt+1;
141
                end if;
142
 
143
                int_res <= not res_cnt(0) or not res_cnt(1) or not res_cnt(2);
144
        end if;
145
end process;
146
 
147
        wd <= wd_out;
148
 
149
        cpu: entity work.leros
150
                port map(clk_int, int_res, ioout, ioin);
151
 
152
        ioin.rddata <= (others => '0');
153
 
154
process(clk_int)
155
begin
156
 
157
        if rising_edge(clk_int) then
158
                if ioout.wr='1' then
159
                        outp <= ioout.wrdata;
160
                end if;
161
                wd_out <= outp(0);
162
        end if;
163
end process;
164
 
165
end rtl;

powered by: WebSVN 2.1.0

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