source: liacs/ca/opdr2b/src/imm.c@ 67

Last change on this file since 67 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: 890 bytes
Line 
1/* Author : Rick van der Zwet
2 * S-number : 0433373
3 * Version : $Id: imm.c 365 2007-12-03 08:54:04Z 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 "imm.h"
13#include "alu.h"
14
15word
16imm_call(const word in, const imm_control_t action)
17{
18 word out = 0;
19 switch (action)
20 {
21 case S16:
22 out = alu_sra(in << 16, 16);
23 break;
24 case SSA:
25 out = alu_sra(in << 21, 27);
26 break;
27 case U26:
28 out = in & 0x03FFFFFF;
29 break;
30 case Z16:
31 out = in & 0x0000FFFF;
32 break;
33 case S16x4:
34 out = alu_sra(in << 16, 14);
35 break;
36 default:
37 fprintf(stderr, "IMM action '%i' not implmented\n", action);
38 exit(EX_SOFTWARE);
39 break;
40 };
41 return (out);
42}
Note: See TracBrowser for help on using the repository browser.