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

Subversion Repositories leros

[/] [leros/] [trunk/] [vhdl/] [top/] [leros_de2-70.vhd] - Blame information for rev 8

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
--
34
--      leros_de2-70.vhd
35
--
36
--      top level for Altera DE2-70 board
37
--
38
--      2011-02-20      creation
39
--
40
--
41
 
42
 
43
library ieee;
44
use ieee.std_logic_1164.all;
45
use ieee.numeric_std.all;
46
 
47
use work.leros_types.all;
48
 
49
 
50
entity leros_top_de2 is
51
 
52
port (
53
        clk : in std_logic;
54
        oLEDG : out std_logic_vector(7 downto 0);
55
        iKEY : in std_logic_vector(3 downto 0);
56
        ser_txd                 : out std_logic;
57
        ser_rxd                 : in std_logic
58
);
59
end leros_top_de2;
60
 
61
architecture rtl of leros_top_de2 is
62
 
63
        signal clk_int                  : std_logic;
64
 
65
        -- for generation of internal reset
66
        signal int_res                  : std_logic;
67
        signal res_cnt                  : unsigned(2 downto 0) := "000"; -- for the simulation
68
 
69
        attribute altera_attribute : string;
70
        attribute altera_attribute of res_cnt : signal is "POWER_UP_LEVEL=LOW";
71
 
72
        signal ioout : io_out_type;
73
        signal ioin : io_in_type;
74
 
75
        signal outp : std_logic_vector(15 downto 0);
76
        signal btn_reg : std_logic_vector(3 downto 0);
77
 
78
 
79
begin
80
 
81
        -- clk input is 50 MHz
82
        -- for now 100 MHz is enough
83
        pll_inst : entity work.pll generic map(
84
                multiply_by => 2,
85
                divide_by => 1
86
        )
87
        port map (
88
                inclk0   => clk,
89
                c0       => clk_int
90
        );
91
 
92
--
93
--      internal reset generation
94
--      should include the PLL lock signal
95
--
96
process(clk_int)
97
begin
98
        if rising_edge(clk_int) then
99
                if (res_cnt/="111") then
100
                        res_cnt <= res_cnt+1;
101
                end if;
102
                int_res <= not res_cnt(0) or not res_cnt(1) or not res_cnt(2);
103
        end if;
104
end process;
105
 
106
 
107
        cpu: entity work.leros
108
                port map(clk_int, int_res, ioout, ioin);
109
 
110
--      ioin.rddata(15 downto 4) <= (others => '0');
111
 
112 8 martin
        ua: entity work.uart generic map (
113
                clk_freq => 100000000,
114
                baud_rate => 115200,
115
                txf_depth => 1,
116
                rxf_depth => 1
117
        )
118
        port map(
119
                clk => clk_int,
120
                reset => int_res,
121 3 martin
 
122 8 martin
                address => ioout.addr(0),
123
                wr_data => ioout.wrdata,
124
                rd => ioout.rd,
125
                wr => ioout.wr,
126
                rd_data => ioin.rddata,
127 3 martin
 
128 8 martin
                txd      => ser_txd,
129
                rxd      => ser_rxd
130 3 martin
        );
131
 
132
process(clk_int)
133
begin
134
 
135
        if rising_edge(clk_int) then
136
                if ioout.wr='1' then
137
                        outp <= ioout.wrdata;
138
                end if;
139
                oLEDG <= outp(7 downto 0);
140
                btn_reg <= iKEY;
141
--              ioin.rddata(3 downto 0) <= not btn_reg;
142
        end if;
143
end process;
144
 
145
end rtl;

powered by: WebSVN 2.1.0

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