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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [processor/] [workspace/] [terasic_de2-115/] [VHDL/] [top.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 jlechner
-----------------------------------------------------------------------
2
-- This file is part of SCARTS.
3
-- 
4
-- SCARTS is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
-- 
9
-- SCARTS is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
-- 
14
-- You should have received a copy of the GNU General Public License
15
-- along with SCARTS.  If not, see <http://www.gnu.org/licenses/>.
16
-----------------------------------------------------------------------
17
 
18
 
19
library ieee;
20
use ieee.std_logic_1164.all;
21
 
22
use work.top_pkg.all;
23
use work.scarts_pkg.all;
24
use work.scarts_amba_pkg.all;
25
use work.pkg_dis7seg.all;
26
 
27
entity top is
28
  port(
29
    db_clk      : in  std_ulogic;
30
    rst         : in  std_ulogic;
31
    -- Debug Interface
32
    D_RxD       : in  std_logic;
33
    D_TxD       : out std_logic;
34
    -- 7Segment Anzeige
35
    digits      : out digit_vector_t(7 downto 0)
36
    );
37
end top;
38
 
39
architecture behaviour of top is
40
 
41
  signal scarts_i    : scarts_in_type;
42
  signal scarts_o    : scarts_out_type;
43
 
44
  signal debugi_if : debug_if_in_type;
45
  signal debugo_if : debug_if_out_type;
46
 
47
  signal exti      : module_in_type;
48
  signal ahbmi     : ahb_master_in_type;
49
 
50
  signal syncrst     : std_ulogic;
51
  signal sysrst      : std_ulogic;
52
  signal clk         : std_logic;
53
  signal dis7segsel  : std_ulogic;
54
  signal dis7segexto : module_out_type;
55
 
56
  component altera_pll IS
57
    PORT
58
      (
59
        areset          : IN STD_LOGIC  := '0';
60
        inclk0          : IN STD_LOGIC  := '0';
61
        c0              : OUT STD_LOGIC ;
62
        locked          : OUT STD_LOGIC
63
        );
64
   END component;
65
 
66
begin
67
 
68
  altera_pll_inst : altera_pll PORT MAP (
69
    areset       => '0',
70
    inclk0       => db_clk,
71
    c0           => clk,
72
    locked       => open
73
    );
74
 
75
  scarts_unit: scarts
76
    generic map (
77
    CONF => (
78
      tech => work.scarts_pkg.ALTERA,
79
      word_size => 32,
80
      boot_rom_size => 12,
81
      instr_ram_size => 16,
82
      data_ram_size => 17,
83
      use_iram => true,
84
      use_amba => false,
85
      amba_shm_size => 8,
86
      amba_word_size => 32,
87
      gdb_mode => 0,
88
      bootrom_base_address => 29
89
      ))
90
    port map(
91
      clk    => clk,
92
      sysrst => sysrst,
93
      extrst => syncrst,
94
      scarts_i => scarts_i,
95
      scarts_o => scarts_o,
96
      ahbmi  => ahbmi,
97
      ahbmo  => open,
98
      debugi_if => debugi_if,
99
      debugo_if => debugo_if
100
      );
101
 
102
  ahbmi <= AMBA_MASTER_IN_VOID;
103
 
104
  dis7seg_unit: ext_dis7seg
105
    generic map (
106
      DIGIT_COUNT => 8,
107
      MULTIPLEXED => 0)
108
    port map(
109
      clk        => clk,
110
      extsel     => dis7segsel,
111
      exti       => exti,
112
      exto       => dis7segexto,
113
      digits     => digits,
114
      DisEna     => open,
115
      PIN_select => open
116
      );
117
 
118
  comb : process(scarts_o, debugo_if, D_RxD, dis7segexto)
119
    variable extdata : std_logic_vector(31 downto 0);
120
  begin
121
    exti.reset    <= scarts_o.reset;
122
    exti.write_en <= scarts_o.write_en;
123
    exti.data     <= scarts_o.data;
124
    exti.addr     <= scarts_o.addr;
125
    exti.byte_en  <= scarts_o.byte_en;
126
 
127
    dis7segsel <= '0';
128
 
129
    if scarts_o.extsel = '1' then
130
      case scarts_o.addr(14 downto 5) is
131
        when "1111110111" => -- (-288)
132
          --DIS7SEG Module
133
          dis7segsel <= '1';
134
        when others =>
135
          null;
136
      end case;
137
    end if;
138
 
139
    extdata := (others => '0');
140
    for i in extdata'left downto extdata'right loop
141
      extdata(i) := dis7segexto.data(i);
142
    end loop;
143
 
144
    scarts_i.data <= (others => '0');
145
    scarts_i.data <= extdata;
146
    scarts_i.hold <= '0';
147
    scarts_i.interruptin <= (others => '0');
148
 
149
 
150
    --Debug interface
151
    D_TxD             <= debugo_if.D_TxD;
152
    debugi_if.D_RxD   <= D_RxD;
153
  end process;
154
 
155
 
156
  reg : process(clk)
157
  begin
158
    if rising_edge(clk) then
159
      --
160
      -- input flip-flops
161
      --
162
      syncrst <= rst;
163
    end if;
164
  end process;
165
 
166
 
167
end behaviour;

powered by: WebSVN 2.1.0

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