Last change
on this file since 148 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
-
Property svn:executable
set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | /* Author : Rick van der Zwet
|
---|
2 | * S-number : 0433373
|
---|
3 | * Version : $Id: constant.c 361 2007-12-03 04:27:55Z rick $
|
---|
4 | * Copyright : FreeBSD Licence
|
---|
5 | * Description : MIPS simulator. Main module
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include <stdlib.h>
|
---|
9 | #include <stdio.h>
|
---|
10 | #include <sysexits.h>
|
---|
11 | #include "sim.h"
|
---|
12 | #include "constant.h"
|
---|
13 |
|
---|
14 | word
|
---|
15 | constant_call(const const_control_t action)
|
---|
16 | {
|
---|
17 | word out = 0;
|
---|
18 | switch (action) {
|
---|
19 | case C0:
|
---|
20 | out = 0;
|
---|
21 | break;
|
---|
22 | case C1:
|
---|
23 | out = 1;
|
---|
24 | break;
|
---|
25 | case C2:
|
---|
26 | out = 2;
|
---|
27 | break;
|
---|
28 | case C3:
|
---|
29 | out = 3;
|
---|
30 | break;
|
---|
31 | case C4:
|
---|
32 | out = 4;
|
---|
33 | break;
|
---|
34 | case C5:
|
---|
35 | out = 8;
|
---|
36 | break;
|
---|
37 | case C6:
|
---|
38 | out = 16;
|
---|
39 | break;
|
---|
40 | case C7:
|
---|
41 | out = 24;
|
---|
42 | break;
|
---|
43 | case C8:
|
---|
44 | out = 31;
|
---|
45 | break;
|
---|
46 | case C9:
|
---|
47 | /* 11110000 00000000 00000000 00000000 */
|
---|
48 | out = 0x1E000000;
|
---|
49 | break;
|
---|
50 | case C10:
|
---|
51 | /* 00000000 00000000 11111111 11111111 */
|
---|
52 | out = 0x0000FFFF;
|
---|
53 | break;
|
---|
54 | case C11:
|
---|
55 | /* 00000000 11111111 11111111 11111111 */
|
---|
56 | out = 0x00FFFFFF;
|
---|
57 | break;
|
---|
58 | case C12:
|
---|
59 | /* 11111111 11111111 11111111 11111100 */
|
---|
60 | out = 0xFFFFFFFC;
|
---|
61 | break;
|
---|
62 | default:
|
---|
63 | fprintf(stderr, "Constant action not implemented\n");
|
---|
64 | exit(EX_SOFTWARE);
|
---|
65 | break;
|
---|
66 | }
|
---|
67 | return (out);
|
---|
68 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.