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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [vhdl/] [control.vhd] - Blame information for rev 139

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rhoads
---------------------------------------------------------------------
2
-- TITLE: Controller / Opcode Decoder
3
-- AUTHOR: Steve Rhoads (rhoadss@yahoo.com)
4
-- DATE CREATED: 2/8/01
5
-- FILENAME: control.vhd
6 43 rhoads
-- PROJECT: Plasma CPU core
7 2 rhoads
-- COPYRIGHT: Software placed into the public domain by the author.
8
--    Software 'as is' without warranty.  Author liable for nothing.
9 39 rhoads
-- NOTE:  MIPS(tm) is a registered trademark of MIPS Technologies.
10
--    MIPS Technologies does not endorse and is not associated with
11
--    this project.
12 2 rhoads
-- DESCRIPTION:
13
--    Controls the CPU by decoding the opcode and generating control 
14
--    signals to the rest of the CPU.
15 39 rhoads
--    This entity decodes the MIPS(tm) opcode into a 
16
--    Very-Long-Word-Instruction.  
17 2 rhoads
--    The 32-bit opcode is converted to a 
18
--       6+6+6+16+5+2+3+3+2+2+3+2+4 = 60 bit VLWI opcode.
19
--    Based on information found in:
20
--       "MIPS RISC Architecture" by Gerry Kane and Joe Heinrich
21
--       and "The Designer's Guide to VHDL" by Peter J. Ashenden
22
---------------------------------------------------------------------
23
library ieee;
24
use ieee.std_logic_1164.all;
25 39 rhoads
use work.mlite_pack.all;
26 2 rhoads
 
27
entity control is
28
   port(opcode       : in  std_logic_vector(31 downto 0);
29
        intr_signal  : in  std_logic;
30
        rs_index     : out std_logic_vector(5 downto 0);
31
        rt_index     : out std_logic_vector(5 downto 0);
32
        rd_index     : out std_logic_vector(5 downto 0);
33
        imm_out      : out std_logic_vector(15 downto 0);
34
        alu_func     : out alu_function_type;
35
        shift_func   : out shift_function_type;
36
        mult_func    : out mult_function_type;
37
        branch_func  : out branch_function_type;
38
        a_source_out : out a_source_type;
39
        b_source_out : out b_source_type;
40
        c_source_out : out c_source_type;
41
        pc_source_out: out pc_source_type;
42
        mem_source_out:out mem_source_type);
43
end; --entity control
44
 
45
architecture logic of control is
46
begin
47
 
48 71 rhoads
control_proc: process(opcode, intr_signal)
49 2 rhoads
   variable op, func       : std_logic_vector(5 downto 0);
50
   variable rs, rt, rd     : std_logic_vector(5 downto 0);
51 46 rhoads
   variable rtx            : std_logic_vector(4 downto 0);
52 2 rhoads
   variable imm            : std_logic_vector(15 downto 0);
53
   variable alu_function   : alu_function_type;
54
   variable shift_function : shift_function_type;
55
   variable mult_function  : mult_function_type;
56
   variable a_source       : a_source_type;
57
   variable b_source       : b_source_type;
58
   variable c_source       : c_source_type;
59
   variable pc_source      : pc_source_type;
60
   variable branch_function: branch_function_type;
61
   variable mem_source     : mem_source_type;
62
begin
63 128 rhoads
   alu_function := ALU_NOTHING;
64
   shift_function := SHIFT_NOTHING;
65
   mult_function := MULT_NOTHING;
66
   a_source := A_FROM_REG_SOURCE;
67
   b_source := B_FROM_REG_TARGET;
68
   c_source := C_FROM_NULL;
69
   pc_source := FROM_INC4;
70
   branch_function := BRANCH_EQ;
71
   mem_source := MEM_FETCH;
72 2 rhoads
   op := opcode(31 downto 26);
73
   rs := '0' & opcode(25 downto 21);
74
   rt := '0' & opcode(20 downto 16);
75
   rtx := opcode(20 downto 16);
76
   rd := '0' & opcode(15 downto 11);
77
   func := opcode(5 downto 0);
78
   imm := opcode(15 downto 0);
79
 
80
   case op is
81 46 rhoads
   when "000000" =>   --SPECIAL
82 2 rhoads
      case func is
83 46 rhoads
      when "000000" =>   --SLL   r[rd]=r[rt]<<re;
84 128 rhoads
         a_source := A_FROM_IMM10_6;
85
         c_source := C_FROM_SHIFT;
86
         shift_function := SHIFT_LEFT_UNSIGNED;
87
 
88 46 rhoads
      when "000010" =>   --SRL   r[rd]=u[rt]>>re;
89 128 rhoads
         a_source := A_FROM_IMM10_6;
90
         c_source := C_FROM_shift;
91
         shift_function := SHIFT_RIGHT_UNSIGNED;
92
 
93 46 rhoads
      when "000011" =>   --SRA   r[rd]=r[rt]>>re;
94 128 rhoads
         a_source := A_FROM_IMM10_6;
95
         c_source := C_FROM_SHIFT;
96
         shift_function := SHIFT_RIGHT_SIGNED;
97
 
98 46 rhoads
      when "000100" =>   --SLLV  r[rd]=r[rt]<<r[rs];
99 128 rhoads
         c_source := C_FROM_SHIFT;
100
         shift_function := SHIFT_LEFT_UNSIGNED;
101
 
102 46 rhoads
      when "000110" =>   --SRLV  r[rd]=u[rt]>>r[rs];
103 128 rhoads
         c_source := C_FROM_SHIFT;
104
         shift_function := SHIFT_RIGHT_UNSIGNED;
105
 
106 46 rhoads
      when "000111" =>   --SRAV  r[rd]=r[rt]>>r[rs];
107 128 rhoads
         c_source := C_FROM_SHIFT;
108
         shift_function := SHIFT_RIGHT_SIGNED;
109
 
110 46 rhoads
      when "001000" =>   --JR    s->pc_next=r[rs];
111 128 rhoads
         pc_source := FROM_BRANCH;
112
         alu_function := ALU_ADD;
113
         branch_function := BRANCH_YES;
114
 
115 46 rhoads
      when "001001" =>   --JALR  r[rd]=s->pc_next; s->pc_next=r[rs];
116 128 rhoads
         c_source := C_FROM_PC_PLUS4;
117
         pc_source := FROM_BRANCH;
118
         alu_function := ALU_ADD;
119
         branch_function := BRANCH_YES;
120
 
121 46 rhoads
      when "001010" =>   --MOVZ  if(!r[rt]) r[rd]=r[rs]; /*IV*/
122 128 rhoads
--         c_source := C_FROM_REG_SOURCE_EQZ;
123
 
124 46 rhoads
      when "001011" =>   --MOVN  if(r[rt]) r[rd]=r[rs];  /*IV*/
125 128 rhoads
--         c_source := FROM_REG_SOURCE_NEZ;
126
 
127 46 rhoads
      when "001100" =>   --SYSCALL
128 2 rhoads
--         if(r[4]==0) printf("0x%8.8lx ",r[5]);
129 128 rhoads
 
130 46 rhoads
      when "001101" =>   --BREAK s->wakeup=1;
131
      when "001111" =>   --SYNC  s->wakeup=1;
132
      when "010000" =>   --MFHI  r[rd]=s->hi;
133 128 rhoads
         c_source := C_FROM_MULT;
134
         mult_function := MULT_READ_HI;
135
 
136 46 rhoads
      when "010001" =>   --FTHI  s->hi=r[rs];
137 128 rhoads
         mult_function := MULT_WRITE_HI;
138
 
139 46 rhoads
      when "010010" =>   --MFLO  r[rd]=s->lo;
140 128 rhoads
         c_source := C_FROM_MULT;
141
         mult_function := MULT_READ_LO;
142
 
143 46 rhoads
      when "010011" =>   --MTLO  s->lo=r[rs];
144 128 rhoads
         mult_function := MULT_WRITE_LO;
145
 
146 46 rhoads
      when "011000" =>   --MULT  s->lo=r[rs]*r[rt]; s->hi=0;
147 128 rhoads
         mult_function := MULT_SIGNED_MULT;
148
 
149 46 rhoads
      when "011001" =>   --MULTU s->lo=r[rs]*r[rt]; s->hi=0;
150 128 rhoads
         mult_function := MULT_MULT;
151
 
152 46 rhoads
      when "011010" =>   --DIV   s->lo=r[rs]/r[rt]; s->hi=r[rs]%r[rt];
153 128 rhoads
         mult_function := MULT_SIGNED_DIVIDE;
154
 
155 46 rhoads
      when "011011" =>   --DIVU  s->lo=r[rs]/r[rt]; s->hi=r[rs]%r[rt];
156 128 rhoads
         mult_function := MULT_DIVIDE;
157
 
158 46 rhoads
      when "100000" =>   --ADD   r[rd]=r[rs]+r[rt];
159 128 rhoads
         c_source := C_FROM_ALU;
160
         alu_function := ALU_ADD;
161
 
162 46 rhoads
      when "100001" =>   --ADDU  r[rd]=r[rs]+r[rt];
163 128 rhoads
         c_source := C_FROM_ALU;
164
         alu_function := ALU_ADD;
165
 
166 46 rhoads
      when "100010" =>   --SUB   r[rd]=r[rs]-r[rt];
167 128 rhoads
         c_source := C_FROM_ALU;
168
         alu_function := ALU_SUBTRACT;
169
 
170 46 rhoads
      when "100011" =>   --SUBU  r[rd]=r[rs]-r[rt];
171 128 rhoads
         c_source := C_FROM_ALU;
172
         alu_function := ALU_SUBTRACT;
173
 
174 46 rhoads
      when "100100" =>   --AND   r[rd]=r[rs]&r[rt];
175 128 rhoads
         c_source := C_FROM_ALU;
176
         alu_function := ALU_AND;
177
 
178 46 rhoads
      when "100101" =>   --OR    r[rd]=r[rs]|r[rt];
179 128 rhoads
         c_source := C_FROM_ALU;
180
         alu_function := ALU_OR;
181
 
182 46 rhoads
      when "100110" =>   --XOR   r[rd]=r[rs]^r[rt];
183 128 rhoads
         c_source := C_FROM_ALU;
184
         alu_function := ALU_XOR;
185
 
186 46 rhoads
      when "100111" =>   --NOR   r[rd]=~(r[rs]|r[rt]);
187 128 rhoads
         c_source := C_FROM_ALU;
188
         alu_function := ALU_NOR;
189
 
190 46 rhoads
      when "101010" =>   --SLT   r[rd]=r[rs]<r[rt];
191 128 rhoads
         c_source := C_FROM_ALU;
192
         alu_function := ALU_LESS_THAN_SIGNED;
193
 
194 46 rhoads
      when "101011" =>   --SLTU  r[rd]=u[rs]<u[rt];
195 128 rhoads
         c_source := C_FROM_ALU;
196
         alu_function := ALU_LESS_THAN;
197
 
198 46 rhoads
      when "101101" =>   --DADDU r[rd]=r[rs]+u[rt];
199 128 rhoads
         c_source := C_FROM_ALU;
200
         alu_function := ALU_ADD;
201
 
202 46 rhoads
      when "110001" =>   --TGEU
203
      when "110010" =>   --TLT
204
      when "110011" =>   --TLTU
205
      when "110100" =>   --TEQ 
206
      when "110110" =>   --TNE 
207 2 rhoads
      when others =>
208
      end case;
209 128 rhoads
 
210 46 rhoads
   when "000001" =>   --REGIMM
211 2 rhoads
      rt := "000000";
212
      rd := "011111";
213 128 rhoads
      a_source := A_FROM_PC;
214
      b_source := B_FROM_IMMX4;
215
      alu_function := ALU_ADD;
216
      pc_source := FROM_BRANCH;
217
      branch_function := BRANCH_GTZ;
218 2 rhoads
      --if(test) pc=pc+imm*4
219 128 rhoads
 
220 2 rhoads
      case rtx is
221 46 rhoads
      when "10000" =>   --BLTZAL  r[31]=s->pc_next; branch=r[rs]<0;
222 128 rhoads
         c_source := C_FROM_PC_PLUS4;
223
         branch_function := BRANCH_LTZ;
224
 
225 46 rhoads
      when "00000" =>   --BLTZ    branch=r[rs]<0;
226 128 rhoads
         branch_function := BRANCH_LTZ;
227
 
228 46 rhoads
      when "10001" =>   --BGEZAL  r[31]=s->pc_next; branch=r[rs]>=0;
229 128 rhoads
         c_source := C_FROM_PC_PLUS4;
230
         branch_function := BRANCH_GEZ;
231
 
232 46 rhoads
      when "00001" =>   --BGEZ    branch=r[rs]>=0;
233 128 rhoads
         branch_function := BRANCH_GEZ;
234
 
235 46 rhoads
      when "10010" =>   --BLTZALL r[31]=s->pc_next; lbranch=r[rs]<0;
236 128 rhoads
         c_source := C_FROM_PC_PLUS4;
237
         pc_source := FROM_LBRANCH;
238
         branch_function := BRANCH_LTZ;
239
 
240 46 rhoads
      when "00010" =>   --BLTZL   lbranch=r[rs]<0;
241 128 rhoads
         pc_source := FROM_LBRANCH;
242
         branch_function := BRANCH_LTZ;
243
 
244 46 rhoads
      when "10011" =>   --BGEZALL r[31]=s->pc_next; lbranch=r[rs]>=0;
245 128 rhoads
         c_source := C_FROM_PC_PLUS4;
246
         pc_source := FROM_LBRANCH;
247
         branch_function := BRANCH_GEZ;
248
 
249 46 rhoads
      when "00011" =>   --BGEZL   lbranch=r[rs]>=0;
250 128 rhoads
         pc_source := FROM_LBRANCH;
251
         branch_function := BRANCH_GEZ;
252
 
253 2 rhoads
          when others =>
254
          end case;
255 128 rhoads
 
256 46 rhoads
   when "000011" =>   --JAL    r[31]=s->pc_next; s->pc_next=(s->pc&0xf0000000)|target;
257 128 rhoads
      c_source := C_FROM_PC_PLUS4;
258 2 rhoads
      rd := "011111";
259 128 rhoads
      pc_source := FROM_OPCODE25_0;
260
 
261 46 rhoads
   when "000010" =>   --J      s->pc_next=(s->pc&0xf0000000)|target; 
262 128 rhoads
      pc_source := FROM_OPCODE25_0;
263
 
264 46 rhoads
   when "000100" =>   --BEQ    branch=r[rs]==r[rt];
265 128 rhoads
      a_source := A_FROM_PC;
266
      b_source := B_FROM_IMMX4;
267
      alu_function := ALU_ADD;
268
      pc_source := FROM_BRANCH;
269
      branch_function := BRANCH_EQ;
270
 
271 46 rhoads
   when "000101" =>   --BNE    branch=r[rs]!=r[rt];
272 128 rhoads
      a_source := A_FROM_PC;
273
      b_source := B_FROM_IMMX4;
274
      alu_function := ALU_ADD;
275
      pc_source := FROM_BRANCH;
276
      branch_function := BRANCH_NE;
277
 
278 46 rhoads
   when "000110" =>   --BLEZ   branch=r[rs]<=0;
279 128 rhoads
      a_source := A_FROM_PC;
280
      b_source := b_FROM_IMMX4;
281
      alu_function := ALU_ADD;
282
      pc_source := FROM_BRANCH;
283
      branch_function := BRANCH_LEZ;
284
 
285 46 rhoads
   when "000111" =>   --BGTZ   branch=r[rs]>0;
286 128 rhoads
      a_source := A_FROM_PC;
287
      b_source := B_FROM_IMMX4;
288
      alu_function := ALU_ADD;
289
      pc_source := FROM_BRANCH;
290
      branch_function := BRANCH_GTZ;
291
 
292 46 rhoads
   when "001000" =>   --ADDI   r[rt]=r[rs]+(short)imm;
293 128 rhoads
      b_source := B_FROM_SIGNED_IMM;
294
      c_source := C_FROM_ALU;
295 2 rhoads
      rd := rt;
296 128 rhoads
      alu_function := ALU_ADD;
297
 
298 46 rhoads
   when "001001" =>   --ADDIU  u[rt]=u[rs]+(short)imm;
299 128 rhoads
      b_source := B_FROM_SIGNED_IMM;
300
      c_source := C_FROM_ALU;
301 2 rhoads
      rd := rt;
302 128 rhoads
      alu_function := ALU_ADD;
303
 
304 46 rhoads
   when "001010" =>   --SLTI   r[rt]=r[rs]<(short)imm;
305 128 rhoads
      b_source := B_FROM_SIGNED_IMM;
306
      c_source := C_FROM_ALU;
307 2 rhoads
      rd := rt;
308 128 rhoads
      alu_function := ALU_LESS_THAN_SIGNED;
309
 
310 46 rhoads
   when "001011" =>   --SLTIU  u[rt]=u[rs]<(unsigned long)(short)imm;
311 128 rhoads
      b_source := B_FROM_IMM;
312
      c_source := C_FROM_ALU;
313 2 rhoads
      rd := rt;
314 128 rhoads
      alu_function := ALU_LESS_THAN;
315
 
316 46 rhoads
   when "001100" =>   --ANDI   r[rt]=r[rs]&imm;
317 128 rhoads
      b_source := B_FROM_IMM;
318
      c_source := C_FROM_ALU;
319 2 rhoads
      rd := rt;
320 128 rhoads
      alu_function := ALU_AND;
321
 
322 46 rhoads
   when "001101" =>   --ORI    r[rt]=r[rs]|imm;
323 128 rhoads
      b_source := B_FROM_IMM;
324
      c_source := C_FROM_ALU;
325 2 rhoads
      rd := rt;
326 128 rhoads
      alu_function := ALU_OR;
327
 
328 46 rhoads
   when "001110" =>   --XORI   r[rt]=r[rs]^imm;
329 128 rhoads
      b_source := B_FROM_IMM;
330
      c_source := C_FROM_ALU;
331 2 rhoads
      rd := rt;
332 128 rhoads
      alu_function := ALU_XOR;
333
 
334 46 rhoads
   when "001111" =>   --LUI    r[rt]=(imm<<16);
335 128 rhoads
      c_source := C_FROM_IMM_SHIFT16;
336 2 rhoads
      rd := rt;
337 128 rhoads
 
338 46 rhoads
   when "010000" =>   --COP0
339 128 rhoads
      alu_function := ALU_OR;
340
      c_source := C_FROM_ALU;
341 2 rhoads
      if opcode(23) = '0' then  --move from CP0
342
         rs := '1' & opcode(15 downto 11);
343
         rt := "000000";
344
         rd := '0' & opcode(20 downto 16);
345
      else                      --move to CP0
346
         rs := "000000";
347
         rd(5) := '1';
348 139 rhoads
         pc_source := FROM_BRANCH;   --delay possible interrupt
349
         branch_function := BRANCH_NO;
350 2 rhoads
      end if;
351 128 rhoads
 
352 46 rhoads
   when "010001" =>   --COP1
353
   when "010010" =>   --COP2
354
   when "010011" =>   --COP3
355
   when "010100" =>   --BEQL   lbranch=r[rs]==r[rt];
356 128 rhoads
      a_source := A_FROM_PC;
357
      b_source := B_FROM_IMMX4;
358
      alu_function := ALU_ADD;
359
      pc_source := FROM_LBRANCH;
360
      branch_function := BRANCH_EQ;
361
 
362 46 rhoads
   when "010101" =>   --BNEL   lbranch=r[rs]!=r[rt];
363 128 rhoads
      a_source := A_FROM_PC;
364
      b_source := B_FROM_IMMX4;
365
      alu_function := ALU_ADD;
366
      pc_source := FROM_LBRANCH;
367
      branch_function := BRANCH_NE;
368
 
369 46 rhoads
   when "010110" =>   --BLEZL  lbranch=r[rs]<=0;
370 128 rhoads
      a_source := A_FROM_PC;
371
      b_source := B_FROM_IMMX4;
372
      alu_function := ALU_ADD;
373
      pc_source := FROM_LBRANCH;
374
      branch_function := BRANCH_LEZ;
375
 
376 46 rhoads
   when "010111" =>   --BGTZL  lbranch=r[rs]>0;
377 128 rhoads
      a_source := A_FROM_PC;
378
      b_source := B_FROM_IMMX4;
379
      alu_function := ALU_ADD;
380
      pc_source := FROM_LBRANCH;
381
      branch_function := BRANCH_GTZ;
382
 
383 46 rhoads
   when "100000" =>   --LB     r[rt]=*(signed char*)ptr;
384 128 rhoads
      a_source := A_FROM_REG_SOURCE;
385
      b_source := B_FROM_SIGNED_IMM;
386
      alu_function := ALU_ADD;
387 17 rhoads
      rd := rt;
388 128 rhoads
      c_source := C_FROM_MEMORY;
389
      mem_source := MEM_READ8S;    --address=(short)imm+r[rs];
390
 
391 46 rhoads
   when "100001" =>   --LH     r[rt]=*(signed short*)ptr;
392 128 rhoads
      a_source := A_FROM_REG_SOURCE;
393
      b_source := B_FROM_SIGNED_IMM;
394
      alu_function := ALU_ADD;
395 17 rhoads
      rd := rt;
396 128 rhoads
      c_source := C_FROM_MEMORY;
397
      mem_source := MEM_READ16S;   --address=(short)imm+r[rs];
398
 
399 46 rhoads
   when "100010" =>   --LWL    //Not Implemented
400 128 rhoads
      a_source := A_FROM_REG_SOURCE;
401
      b_source := B_FROM_SIGNED_IMM;
402
      alu_function := ALU_ADD;
403 17 rhoads
      rd := rt;
404 128 rhoads
      c_source := C_FROM_MEMORY;
405
      mem_source := MEM_READ32;
406
 
407 46 rhoads
   when "100011" =>   --LW     r[rt]=*(long*)ptr;
408 128 rhoads
      a_source := A_FROM_REG_SOURCE;
409
      b_source := B_FROM_SIGNED_IMM;
410
      alu_function := ALU_ADD;
411 17 rhoads
      rd := rt;
412 128 rhoads
      c_source := C_FROM_MEMORY;
413
      mem_source := MEM_READ32;
414
 
415 46 rhoads
   when "100100" =>   --LBU    r[rt]=*(unsigned char*)ptr;
416 128 rhoads
      a_source := A_FROM_REG_SOURCE;
417
      b_source := B_FROM_SIGNED_IMM;
418
      alu_function := ALU_ADD;
419 17 rhoads
      rd := rt;
420 128 rhoads
      c_source := C_FROM_MEMORY;
421
      mem_source := MEM_READ8;    --address=(short)imm+r[rs];
422
 
423 46 rhoads
   when "100101" =>   --LHU    r[rt]=*(unsigned short*)ptr;
424 128 rhoads
      a_source := A_FROM_REG_SOURCE;
425
      b_source := B_FROM_SIGNED_IMM;
426
      alu_function := ALU_ADD;
427 17 rhoads
      rd := rt;
428 128 rhoads
      c_source := C_FROM_MEMORY;
429
      mem_source := MEM_READ16;    --address=(short)imm+r[rs];
430
 
431 46 rhoads
   when "100110" =>   --LWR    //Not Implemented
432
   when "101000" =>   --SB     *(char*)ptr=(char)r[rt];
433 128 rhoads
      a_source := A_FROM_REG_SOURCE;
434
      b_source := B_FROM_SIGNED_IMM;
435
      alu_function := ALU_ADD;
436
      mem_source := MEM_WRITE8;   --address=(short)imm+r[rs];
437
 
438 46 rhoads
   when "101001" =>   --SH     *(short*)ptr=(short)r[rt];
439 128 rhoads
      a_source := A_FROM_REG_SOURCE;
440
      b_source := B_FROM_SIGNED_IMM;
441
      alu_function := ALU_ADD;
442
      mem_source := MEM_WRITE16;
443
 
444 46 rhoads
   when "101010" =>   --SWL    //Not Implemented
445 128 rhoads
      a_source := A_FROM_REG_SOURCE;
446
      b_source := B_FROM_SIGNED_IMM;
447
      alu_function := ALU_ADD;
448
      mem_source := MEM_WRITE32;  --address=(short)imm+r[rs];
449
 
450 46 rhoads
   when "101011" =>   --SW     *(long*)ptr=r[rt];
451 128 rhoads
      a_source := A_FROM_REG_SOURCE;
452
      b_source := B_FROM_SIGNED_IMM;
453
      alu_function := ALU_ADD;
454
      mem_source := MEM_WRITE32;  --address=(short)imm+r[rs];
455
 
456 46 rhoads
   when "101110" =>   --SWR    //Not Implemented
457
   when "101111" =>   --CACHE
458
   when "110000" =>   --LL     r[rt]=*(long*)ptr;
459
   when "110001" =>   --LWC1 
460
   when "110010" =>   --LWC2 
461
   when "110011" =>   --LWC3 
462
   when "110101" =>   --LDC1 
463
   when "110110" =>   --LDC2 
464
   when "110111" =>   --LDC3 
465
   when "111000" =>   --SC     *(long*)ptr=r[rt]; r[rt]=1;
466
   when "111001" =>   --SWC1 
467
   when "111010" =>   --SWC2 
468
   when "111011" =>   --SWC3 
469
   when "111101" =>   --SDC1 
470
   when "111110" =>   --SDC2 
471
   when "111111" =>   --SDC3 
472 2 rhoads
   when others =>
473
   end case;
474
 
475 128 rhoads
   if c_source = C_FROM_NULL then
476 2 rhoads
      rd := "000000";
477
   end if;
478
 
479
   if intr_signal = '1' then
480
      rs := "111111";  --interrupt vector
481
      rt := "000000";
482 6 rhoads
      rd := "101110";  --save PC in EPC
483 128 rhoads
      alu_function := ALU_OR;
484
      shift_function := SHIFT_NOTHING;
485
      mult_function := MULT_NOTHING;
486
      branch_function := BRANCH_YES;
487
      a_source := A_FROM_REG_SOURCE;
488
      b_source := B_FROM_REG_TARGET;
489 139 rhoads
      c_source := C_FROM_PC;
490 128 rhoads
      pc_source := FROM_LBRANCH;
491
      mem_source := MEM_FETCH;
492 2 rhoads
   end if;
493
 
494
   rs_index <= rs;
495
   rt_index <= rt;
496
   rd_index <= rd;
497
   imm_out <= imm;
498
   alu_func <= alu_function;
499
   shift_func <= shift_function;
500
   mult_func <= mult_function;
501
   branch_func <= branch_function;
502
   a_source_out <= a_source;
503
   b_source_out <= b_source;
504
   c_source_out <= c_source;
505
   pc_source_out <= pc_source;
506
   mem_source_out <= mem_source;
507
 
508
end process;
509
 
510
end; --logic

powered by: WebSVN 2.1.0

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