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

Subversion Repositories mcip_open

[/] [mcip_open/] [trunk/] [MCIPopen_XilinxISEproject/] [CPU.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:    18:40:51 06/05/05
6
-- Design Name:    CPU assembly
7
-- Module Name:    CPU - CPUnit
8
-- Project Name:   Microcontroller IP (MCIP)
9
-- Target Device:  xc3s500e-4fg320
10
-- Tool versions:  Xilinx ISE 9.1.03i
11
-- Description:  CPU compenents mapping (Instruction Decoder, Operation unit,
12
--                                               Program counter, Address provider).
13
-- Revision:             07/07/2008
14
-- Revision  2.2 - Add description
15
--------------------------------------------------------------------------------
16
library IEEE;
17
use IEEE.STD_LOGIC_1164.ALL;
18
 
19
 
20
entity CPU is
21
    Generic ( STKPTR_length : integer := 5;  -- Stack Pointer Length -- < 6
22
                                  STVREN : std_logic := '1');   -- Stack Overflow/Underflow Reset Enable bit
23
    Port ( nreset             : in std_logic;
24
           Q                  : in std_logic_vector(1 to 4);
25
           Instruction        : in std_logic_vector(15 downto 0);
26
           DATA               : inout std_logic_vector(7 downto 0);
27
 
28
           Istruction_address : out std_logic_vector(20 downto 0);
29
           Data_address       : out std_logic_vector(11 downto 0);
30
           address_latch_port : out std_logic_vector(3 downto 0);
31
                          r_w_ram            : out std_logic_vector(1 downto 0);
32
                          r_w_port           : out std_logic_vector(1 downto 0);
33
                          r_w_wdt            : out std_logic_vector(1 downto 0);
34
                          soft_reset_enable  : out std_logic;
35
                          sleep_mode_enable  : out std_logic;
36
                          clear_watchdog     : out std_logic;
37
                          stack_overflow     : out std_logic );
38
end CPU;
39
 
40
architecture CPUnit of CPU is
41
 
42
component Instruction_Decoder
43
    Port ( nreset            : in std_logic;
44
                          Q1                : in std_logic;
45
                          Q4                : in std_logic;
46
                          Fetched_instruction : in std_logic_vector(15 downto 0);
47
                          Data_add          : in std_logic_vector(11 downto 0);
48
                          New_status        : in std_logic_vector(4 downto 0);
49
                          Set_response      : in std_logic_vector(1 downto 0);
50
                          Data              : inout std_logic_vector(7 downto 0);
51
                          Command_vector_opu : out std_logic_vector(13 downto 0);
52
                          Command_vector_pc : out std_logic_vector(6 downto 0);
53
                          Command_status    : out std_logic_vector(4 downto 0);
54
                          Current_status    : out std_logic_vector(4 downto 0);
55
                          Bit_op            : out std_logic_vector(2 downto 0);
56
                          call_return       : out std_logic_vector(1 downto 0);
57
                          IR11_0            : out std_logic_vector(11 downto 0);
58
                          r_w_ram           : out std_logic_vector(1 downto 0);
59
                          r_w_add_pr        : out std_logic_vector(1 downto 0);
60
                          r_w_opu           : out std_logic_vector(1 downto 0);
61
                          r_w_port          : out std_logic_vector(1 downto 0);
62
                          r_w_wdt           : out std_logic_vector(1 downto 0);
63
                          bit_op_enable     : out std_logic;
64
                          load_FREG         : out std_logic;
65
                          read_result       : out std_logic;
66
                          WREG_write_enable : out std_logic;
67
                          MUL_enable        : out std_logic;
68
                          MOVFF_enable      : out std_logic;
69
                          load_BSR          : out std_logic;
70
                          soft_reset_enable : out std_logic;
71
                          sleep_mode_enable : out std_logic;
72
                          clear_watchdog    : out std_logic
73
                                );
74
end component Instruction_Decoder;
75
 
76
component Operation_Unit
77
    Port ( nreset        : in std_logic;
78
           Q             : in std_logic_vector(1 to 4);
79
                          CommandVector : in std_logic_vector(13 downto 0);
80
           CommandStatus : in std_logic_vector(4 downto 0);
81
           OldStatus     : in std_logic_vector(4 downto 0);
82
           R_W           : in std_logic_vector(1 downto 0);
83
           BitOp         : in std_logic_vector(2 downto 0);
84
                          call_return   : in std_logic_vector(1 downto 0);
85
                          Address_Latch : in std_logic_vector(1 downto 0);
86
                          BitOp_enable  : in std_logic;
87
                          WREG_write    : in std_logic;
88
                          MUL_enable    : in std_logic;
89
                          Read_result   : in std_logic;
90
                          Load_FREG     : in std_logic;
91
           DATA          : inout std_logic_vector(7 downto 0);
92
           NewStatus     : out std_logic_vector(4 downto 0);
93
                          SetResponse   : out std_logic_vector(1 downto 0) );
94
end component Operation_Unit;
95
 
96
component Program_Counter
97
    Generic ( STKPTR_length : integer := 5;  -- Stack Pointer Length -- < 6
98
                                  STVREN : std_logic := '1');   -- Stack Overflow/Underflow Reset Enable bit
99
    Port ( nreset         : in std_logic;
100
           Q2             : in std_logic;
101
           Q4             : in std_logic;
102
           Command_vector : in std_logic_vector(6 downto 0);
103
                          Branch_data    : in std_logic_vector(11 downto 0);
104
                          stack_overflow : out std_logic;
105
                          IAddress        : out std_logic_vector(20 downto 1));
106
end component Program_Counter;
107
 
108
component Address_Provider
109
    Port ( Q1            : in std_logic;
110
                          Q4            : in std_logic;
111
           nreset        : in std_logic;
112
           IR11_0        : in std_logic_vector(11 downto 0);
113
           R_W           : in std_logic_vector(1 downto 0);
114
                          call_return   : in std_logic_vector(1 downto 0);
115
                          MovFF_enable  : in std_logic;
116
                          load_BSR      : in std_logic;
117
           DATA          : inout std_logic_vector(7 downto 0);
118
           Address_RAM   : out std_logic_vector(11 downto 0));
119
end component Address_Provider;
120
 
121
--component Table_Read
122
--    Port ( nreset               : in std_logic;
123
--           Q1                   : in std_logic;
124
--           Q4                   : in std_logic;
125
--           enable               : in std_logic;
126
--           r_w                  : in std_logic_vector(1 downto 0);
127
--           IR1_0                : in std_logic_vector(1 downto 0);
128
--           pm_data              : in std_logic_vector(7 downto 0);
129
--                        PCIstruction_address : in std_logic_vector(IALength-1 downto 0);
130
--           Data                 : inout std_logic_vector(7 downto 0);
131
--                        Istruction_address   : out std_logic_vector(IALength-1 downto 0));
132
--end component Table_Read;
133
 
134
        signal Command_vector_opu   : std_logic_vector(13 downto 0);
135
        signal Command_vector_pc    : std_logic_vector(6 downto 0);
136
        signal Command_status       : std_logic_vector(4 downto 0);
137
        signal PCIstruction_address : std_logic_vector(20 downto 1);
138
        signal Current_status     : std_logic_vector(4 downto 0);
139
        signal New_status         : std_logic_vector(4 downto 0);
140
        signal IR11_0             : std_logic_vector(11 downto 0);
141
        signal Data_address_s     : std_logic_vector(11 downto 0);
142
        signal address_latch_cu   : std_logic_vector(1 downto 0);
143
        signal Set_response       : std_logic_vector(1 downto 0);
144
        signal Bit_op             : std_logic_vector(2 downto 0);
145
        signal call_return        : std_logic_vector(1 downto 0);
146
        signal r_w_add_pr         : std_logic_vector(1 downto 0);
147
        signal r_w_opu            : std_logic_vector(1 downto 0);
148
        signal bit_op_enable      : std_logic;
149
        signal load_FREG          : std_logic;
150
        signal read_result        : std_logic;
151
        signal WREG_write_enable  : std_logic;
152
        signal MUL_enable         : std_logic;
153
        signal MOVFF_enable       : std_logic;
154
        signal load_BSR           : std_logic;
155
 
156
begin
157
 
158
InstructionDecoder : Instruction_Decoder
159
Port map ( nreset            => nreset,
160
                          Q1                => Q(1),
161
                          Q4                => Q(4),
162
                          Fetched_instruction => Instruction,
163
                          Data_add          => Data_address_s,
164
                          New_status        => New_status,
165
                          Set_response      => Set_response,
166
                          Data              => Data,
167
                          Command_vector_opu => Command_vector_opu,
168
                          Command_vector_pc => Command_vector_pc,
169
                          Command_status    => Command_status,
170
                          Current_status    => Current_status,
171
                          Bit_op            => Bit_op,
172
                          call_return       => call_return,
173
                          IR11_0            => IR11_0,
174
                          r_w_ram           => r_w_ram,
175
                          r_w_add_pr        => r_w_add_pr,
176
                          r_w_opu           => r_w_opu,
177
                          r_w_port          => r_w_port,
178
                          r_w_wdt           => r_w_wdt,
179
                          bit_op_enable     => bit_op_enable,
180
                          load_FREG         => load_FREG,
181
                          read_result       => read_result,
182
                          WREG_write_enable => WREG_write_enable,
183
                          MUL_enable        => MUL_enable,
184
                          MOVFF_enable      => MOVFF_enable,
185
                          load_BSR          => load_BSR,
186
                          soft_reset_enable => soft_reset_enable,
187
                          sleep_mode_enable => sleep_mode_enable,
188
                          clear_watchdog    => clear_watchdog
189
                          );
190
 
191
OperationUnit : Operation_Unit
192
Port map ( nreset        => nreset,
193
           Q             => Q,
194
                          CommandVector => Command_vector_opu,
195
           CommandStatus => Command_status,
196
           OldStatus     => Current_status,
197
           R_W           => r_w_opu,
198
           BitOp         => Bit_op,
199
                          call_return   => call_return,
200
                          Address_Latch => address_latch_cu,
201
                          BitOp_enable  => bit_op_enable,
202
                          WREG_write    => WREG_write_enable,
203
                          MUL_enable    => MUL_enable,
204
                          Read_result   => read_result,
205
                          Load_FREG     => load_FREG,
206
           DATA          => DATA,
207
--           Wregister     => Wregister,
208
           NewStatus     => New_status,
209
                          SetResponse   => Set_response );
210
 
211
PC : Program_Counter
212
Generic map(  STKPTR_length => STKPTR_length,
213
                                  STVREN => STVREN)
214
Port map ( nreset         => nreset,
215
--           Q1             => Q(1),
216
           Q2             => Q(2),
217
           Q4             => Q(4),
218
--                        freeze         => freeze,
219
           Command_vector => Command_vector_pc,
220
                          Branch_data    => IR11_0,
221
--                        R_W            => r_w_pc,
222
--                        Data           => DATA,
223
                          stack_overflow => stack_overflow,
224
                          IAddress        => PCIstruction_address );
225
 
226
Address_RAM : Address_Provider
227
Port map ( Q1            => Q(1),
228
                          Q4            => Q(4),
229
           nreset        => nreset,
230
           IR11_0        => IR11_0,
231
--           Wregister     => Wregister,
232
           R_W           => r_w_add_pr,
233
--           loadFSRx      => load_FSRx,
234
                          call_return   => call_return,
235
                          MovFF_enable  => MOVFF_enable,
236
                          load_BSR      => load_BSR,
237
--                        INDFx_enable  => INDFx_enable,
238
           DATA          => DATA,
239
--                        SFR_ind       => SFR_ind,
240
           Address_RAM   => Data_address_s );
241
 
242
--Tab_read : Table_Read
243
--Port map ( nreset               => nreset,
244
--           Q1                   => Q(1),
245
--           Q4                   => Q(4),
246
--           enable               => tableread,
247
--           r_w                  => r_w_tbr,
248
--           IR1_0                => IR11_0(1 downto 0),
249
--           pm_data              => Instruction(7 downto 0),
250
--                        PCIstruction_address => PCIstruction_address,
251
--           Data                 => DATA,
252
--                        Istruction_address   => Istruction_address );
253
 
254
        Istruction_address <= PCIstruction_address & '0';
255
        address_latch_port <= IR11_0(4 downto 3)&IR11_0(1 downto 0);
256
--      address_latch_tmr  <= IR11_0(1 downto 0);
257
        address_latch_cu   <= IR11_0(2)&IR11_0(0);
258
        Data_address   <= Data_address_s;
259
 
260
end CPUnit;

powered by: WebSVN 2.1.0

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