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

Subversion Repositories mcip_open

[/] [mcip_open/] [trunk/] [MCIPopen_XilinxISEproject/] [MCIPopen.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 mezzah
--------------------------------------------------------------------------------
2
-- Company:        Ferhat Abbas University - Algeria
3
-- Engineer:       Ibrahim MEZZAH
4
-- Progect Supervisor: Dr H. Chemali
5
-- Create Date:    july 2015
6
-- Design Name:    MCIP open
7
-- Module Name:    MCIPopen
8
-- Project Name:   Microcontroller IP (MCIP)
9
-- Target Device:  xc3s500e-4fg320
10
-- Tool versions:  Xilinx ISE 14
11
-- Description:  "MCIP open" is a light vertion of MCIP core, it is compatible
12
--                 whith Microchip PIC18 microcontrolle.
13
-- Revision:             
14
-- Revision 0
15
--------------------------------------------------------------------------------
16
library IEEE;
17
use IEEE.STD_LOGIC_1164.ALL;
18
 
19
 
20
entity MCIPopen is
21
    Generic ( STKPTR_length : integer := 5;  -- Stack Pointer Length -- < 6
22
                                  STVREN : std_logic := '1';    -- Stack Overflow/Underflow Reset Enable bit
23
                                  WDTPS : std_logic_vector(3 downto 0) := "0100"; -- Watchdog Timer Postscale Select bits
24
                                  WDTEN : std_logic := '0'); -- Watchdog Timer enable bit
25
 
26
    Port ( nreset             : in std_logic;
27
           clock              : in std_logic;
28
                          Wdt_clock                             : in std_logic;
29
           Instruction        : in std_logic_vector(15 downto 0);
30
                          clock_out          : out std_logic;
31
                          nresetDevice       : out std_logic;
32
                          Q1                 : out std_logic;
33
                          Q4                 : out std_logic;
34
                          RE_ram             : out std_logic;
35
                          WE_ram             : out std_logic;
36
           Istruction_address : out std_logic_vector(20 downto 0);
37
           Data_address       : out std_logic_vector(11 downto 0);
38
           Data_Bus           : inout std_logic_vector(7 downto 0);
39
           PORTA              : inout std_logic_vector(7 downto 0);
40
           PORTB              : inout std_logic_vector(7 downto 0);
41
           PORTC              : inout std_logic_vector(7 downto 0);
42
           PORTD              : inout std_logic_vector(7 downto 0) );
43
end MCIPopen;
44
 
45
architecture mapping of MCIPopen is
46
 
47
component CPU
48
    Generic ( STKPTR_length : integer := 5;
49
                                  STVREN : std_logic := '1');
50
    Port ( nreset             : in std_logic;
51
           Q                  : in std_logic_vector(1 to 4);
52
           Instruction        : in std_logic_vector(15 downto 0);
53
           DATA               : inout std_logic_vector(7 downto 0);
54
           Istruction_address : out std_logic_vector(20 downto 0);
55
           Data_address       : out std_logic_vector(11 downto 0);
56
           address_latch_port : out std_logic_vector(3 downto 0);
57
                          r_w_ram            : out std_logic_vector(1 downto 0);
58
                          r_w_port           : out std_logic_vector(1 downto 0);
59
                          r_w_wdt            : out std_logic_vector(1 downto 0);
60
                          soft_reset_enable  : out std_logic;
61
                          sleep_mode_enable  : out std_logic;
62
                          clear_watchdog     : out std_logic;
63
                          stack_overflow     : out std_logic );
64
end component CPU;
65
 
66
component PORTs
67
    Port ( nreset        : in std_logic;
68
           Q1            : in std_logic;
69
           Q4            : in std_logic;
70
                          RE            : in std_logic;
71
                          WE            : in std_logic;
72
           SFRs_Address  : in std_logic_vector(3 downto 0);
73
           DATA          : inout std_logic_vector(7 downto 0);
74
           PORTA         : inout std_logic_vector(7 downto 0);
75
           PORTB         : inout std_logic_vector(7 downto 0);
76
           PORTC         : inout std_logic_vector(7 downto 0);
77
           PORTD         : inout std_logic_vector(7 downto 0));
78
end component PORTs;
79
 
80
component reset_module
81
    Port ( clock                                : in std_logic;
82
           nExternal_reset      : in std_logic;
83
                          Soft_reset            : in std_logic;
84
           WDT_reset                    : in std_logic;
85
           Stack_reset          : in std_logic;
86
           nreset                               : out std_logic);
87
end component reset_module;
88
 
89
component PLL
90
    Port ( clock             : in std_logic;
91
           nreset            : in std_logic;
92
           IDLEN                                  : in std_logic;
93
           Sleep_mode_enable : in std_logic;
94
           Q1                : out std_logic;
95
           Q2                : out std_logic;
96
           Q3                : out std_logic;
97
           Q4                : out std_logic;
98
           internal_clock         : out std_logic);
99
end component PLL;
100
 
101
component Watchdog
102
         Generic(WDTPS : std_logic_vector(3 downto 0) := "0100";
103
                                WDTEN : std_logic := '0');
104
    Port ( nreset       : in std_logic;
105
           WDT_clock    : in std_logic;
106
           Q1           : in std_logic;
107
           Q4           : in std_logic;
108
           RE           : in std_logic;
109
           WE           : in std_logic;
110
           clrWDT       : in std_logic;
111
           Sleep                   : in std_logic;
112
           DATA         : inout std_logic_vector(7 downto 0);
113
           WDT_reset    : out std_logic;
114
           WDTwake_up   : out std_logic);
115
end component Watchdog;
116
 
117
 
118
        signal Q                  : std_logic_vector(1 to 4);
119
        signal address_latch_port : std_logic_vector(3 downto 0);
120
        signal r_w_port           : std_logic_vector(1 downto 0);
121
        signal r_w_wdt            : std_logic_vector(1 downto 0);
122
        signal r_w_ram                    : std_logic_vector(1 downto 0);
123
        signal soft_reset_enable  : std_logic;
124
        signal sleep_mode_enable  : std_logic;
125
        signal sleep_mode                         : std_logic;
126
        signal clear_watchdog     : std_logic;
127
        signal WDTwake_up                    : std_logic;
128
        signal WDT_reset                     : std_logic;
129
        signal stack_overflow     : std_logic;
130
        signal nreset_device      : std_logic;
131
        signal clock_div4         : std_logic;
132
 
133
begin
134
 
135
CPU_block : CPU
136
Generic map( STKPTR_length => STKPTR_length,
137
                                 STVREN => STVREN)
138
Port map ( nreset             => nreset_device,
139
           Q                  => Q,
140
           Instruction        => Instruction,
141
           DATA               => DATA_BUS,
142
           Istruction_address => Istruction_address,
143
           Data_address       => Data_address,
144
           address_latch_port => address_latch_port,
145
                          r_w_ram            => r_w_ram,
146
                          r_w_port           => r_w_port,
147
                          r_w_wdt            => r_w_wdt,
148
                          soft_reset_enable  => soft_reset_enable,
149
                          sleep_mode_enable  => sleep_mode_enable,
150
                          clear_watchdog     => clear_watchdog,
151
                          stack_overflow     => stack_overflow );
152
 
153
Ports_block : PORTs
154
Port map ( nreset        => nreset_device,
155
           Q1            => Q(1),
156
           Q4            => Q(4),
157
                          RE            => r_w_port(1),
158
                          WE            => r_w_port(0),
159
           SFRs_Address  => address_latch_port,
160
           DATA          => DATA_BUS,
161
           PORTA         => PORTA,
162
           PORTB         => PORTB,
163
           PORTC         => PORTC,
164
           PORTD         => PORTD);
165
 
166
Reset_u: reset_module
167
Port map ( clock                                => clock,
168
           nExternal_reset      => nreset,
169
                          Soft_reset            => soft_reset_enable,
170
           WDT_reset                    => WDT_reset,
171
           Stack_reset          => stack_overflow,
172
           nreset                               => nreset_device);
173
 
174
PLL_u: PLL
175
Port map ( clock             => clock,
176
           nreset            => nreset_device,
177
           IDLEN                                  => '0',
178
           Sleep_mode_enable => sleep_mode,
179
           Q1                => Q(1),
180
           Q2                => Q(2),
181
           Q3                => Q(3),
182
           Q4                => Q(4),
183
           internal_clock         => clock_div4);
184
 
185
Watchdog_u: Watchdog
186
Generic map(WDTPS => WDTPS,
187
                                WDTEN => WDTEN)
188
Port map ( nreset       => nreset_device,
189
           WDT_clock    => Wdt_clock,
190
           Q1           => Q(1),
191
           Q4           => Q(4),
192
           RE           => r_w_wdt(1),
193
           WE           => r_w_wdt(0),
194
           clrWDT       => clear_watchdog,
195
           Sleep                   => sleep_mode_enable,
196
           DATA         => DATA_BUS,
197
           WDT_reset    => WDT_reset,
198
           WDTwake_up   => WDTwake_up);
199
 
200
 
201
        Q1 <= Q(1);
202
        Q4 <= Q(4);
203
        RE_ram <= r_w_ram(1);
204
        WE_ram <= r_w_ram(0);
205
        clock_out    <= clock_div4;
206
        nresetDevice <= nreset_device;
207
        sleep_mode <= '1' when sleep_mode_enable = '1' and WDTwake_up = '0' else '0';
208
 
209
end mapping;

powered by: WebSVN 2.1.0

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