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

Subversion Repositories leros

[/] [leros/] [trunk/] [vhdl/] [top/] [leros_de2-70.vhd] - Diff between revs 3 and 8

Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 8
--
--
--  Copyright 2011 Martin Schoeberl <masca@imm.dtu.dk>,
--  Copyright 2011 Martin Schoeberl <masca@imm.dtu.dk>,
--                 Technical University of Denmark, DTU Informatics. 
--                 Technical University of Denmark, DTU Informatics. 
--  All rights reserved.
--  All rights reserved.
--
--
-- Redistribution and use in source and binary forms, with or without
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- modification, are permitted provided that the following conditions are met:
-- 
-- 
--    1. Redistributions of source code must retain the above copyright notice,
--    1. Redistributions of source code must retain the above copyright notice,
--       this list of conditions and the following disclaimer.
--       this list of conditions and the following disclaimer.
-- 
-- 
--    2. Redistributions in binary form must reproduce the above copyright
--    2. Redistributions in binary form must reproduce the above copyright
--       notice, this list of conditions and the following disclaimer in the
--       notice, this list of conditions and the following disclaimer in the
--       documentation and/or other materials provided with the distribution.
--       documentation and/or other materials provided with the distribution.
-- 
-- 
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
-- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
-- NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
-- NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- 
-- 
-- The views and conclusions contained in the software and documentation are
-- The views and conclusions contained in the software and documentation are
-- those of the authors and should not be interpreted as representing official
-- those of the authors and should not be interpreted as representing official
-- policies, either expressed or implied, of the copyright holder.
-- policies, either expressed or implied, of the copyright holder.
-- 
-- 
 
 
 
 
--
--
--      leros_de2-70.vhd
--      leros_de2-70.vhd
--
--
--      top level for Altera DE2-70 board
--      top level for Altera DE2-70 board
--
--
--      2011-02-20      creation
--      2011-02-20      creation
--
--
--
--
 
 
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.numeric_std.all;
 
 
use work.leros_types.all;
use work.leros_types.all;
 
 
 
 
entity leros_top_de2 is
entity leros_top_de2 is
 
 
port (
port (
        clk : in std_logic;
        clk : in std_logic;
        oLEDG : out std_logic_vector(7 downto 0);
        oLEDG : out std_logic_vector(7 downto 0);
        iKEY : in std_logic_vector(3 downto 0);
        iKEY : in std_logic_vector(3 downto 0);
        ser_txd                 : out std_logic;
        ser_txd                 : out std_logic;
        ser_rxd                 : in std_logic
        ser_rxd                 : in std_logic
);
);
end leros_top_de2;
end leros_top_de2;
 
 
architecture rtl of leros_top_de2 is
architecture rtl of leros_top_de2 is
 
 
        signal clk_int                  : std_logic;
        signal clk_int                  : std_logic;
 
 
        -- for generation of internal reset
        -- for generation of internal reset
        signal int_res                  : std_logic;
        signal int_res                  : std_logic;
        signal res_cnt                  : unsigned(2 downto 0) := "000"; -- for the simulation
        signal res_cnt                  : unsigned(2 downto 0) := "000"; -- for the simulation
 
 
        attribute altera_attribute : string;
        attribute altera_attribute : string;
        attribute altera_attribute of res_cnt : signal is "POWER_UP_LEVEL=LOW";
        attribute altera_attribute of res_cnt : signal is "POWER_UP_LEVEL=LOW";
 
 
        signal ioout : io_out_type;
        signal ioout : io_out_type;
        signal ioin : io_in_type;
        signal ioin : io_in_type;
 
 
        signal outp : std_logic_vector(15 downto 0);
        signal outp : std_logic_vector(15 downto 0);
        signal btn_reg : std_logic_vector(3 downto 0);
        signal btn_reg : std_logic_vector(3 downto 0);
 
 
 
 
begin
begin
 
 
        -- clk input is 50 MHz
        -- clk input is 50 MHz
        -- for now 100 MHz is enough
        -- for now 100 MHz is enough
        pll_inst : entity work.pll generic map(
        pll_inst : entity work.pll generic map(
                multiply_by => 2,
                multiply_by => 2,
                divide_by => 1
                divide_by => 1
        )
        )
        port map (
        port map (
                inclk0   => clk,
                inclk0   => clk,
                c0       => clk_int
                c0       => clk_int
        );
        );
 
 
--
--
--      internal reset generation
--      internal reset generation
--      should include the PLL lock signal
--      should include the PLL lock signal
--
--
process(clk_int)
process(clk_int)
begin
begin
        if rising_edge(clk_int) then
        if rising_edge(clk_int) then
                if (res_cnt/="111") then
                if (res_cnt/="111") then
                        res_cnt <= res_cnt+1;
                        res_cnt <= res_cnt+1;
                end if;
                end if;
                int_res <= not res_cnt(0) or not res_cnt(1) or not res_cnt(2);
                int_res <= not res_cnt(0) or not res_cnt(1) or not res_cnt(2);
        end if;
        end if;
end process;
end process;
 
 
 
 
        cpu: entity work.leros
        cpu: entity work.leros
                port map(clk_int, int_res, ioout, ioin);
                port map(clk_int, int_res, ioout, ioin);
 
 
--      ioin.rddata(15 downto 4) <= (others => '0');
--      ioin.rddata(15 downto 4) <= (others => '0');
 
 
                ua: entity work.uart generic map (
        ua: entity work.uart generic map (
                        clk_freq => 100000000,
                clk_freq => 100000000,
                        baud_rate => 115200,
                baud_rate => 115200,
                        txf_depth => 1,
                txf_depth => 1,
                        rxf_depth => 1
                rxf_depth => 1
                )
        )
                port map(
        port map(
                        clk => clk_int,
                clk => clk_int,
                        reset => int_res,
                reset => int_res,
 
 
                        address => ioout.addr(0),
                address => ioout.addr(0),
                        wr_data => ioout.wrdata,
                wr_data => ioout.wrdata,
                        rd => ioout.rd,
                rd => ioout.rd,
                        wr => ioout.wr,
                wr => ioout.wr,
                        rd_data => ioin.rddata,
                rd_data => ioin.rddata,
 
 
                        txd      => ser_txd,
                txd      => ser_txd,
                        rxd      => ser_rxd
                rxd      => ser_rxd
        );
        );
 
 
process(clk_int)
process(clk_int)
begin
begin
 
 
        if rising_edge(clk_int) then
        if rising_edge(clk_int) then
                if ioout.wr='1' then
                if ioout.wr='1' then
                        outp <= ioout.wrdata;
                        outp <= ioout.wrdata;
                end if;
                end if;
                oLEDG <= outp(7 downto 0);
                oLEDG <= outp(7 downto 0);
                btn_reg <= iKEY;
                btn_reg <= iKEY;
--              ioin.rddata(3 downto 0) <= not btn_reg;
--              ioin.rddata(3 downto 0) <= not btn_reg;
        end if;
        end if;
end process;
end process;
 
 
end rtl;
end rtl;
 
 

powered by: WebSVN 2.1.0

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