field.h
Go to the documentation of this file.
1 #ifndef __FIELD_H__
2 #define __FIELD_H__
3 
4 /*
5  * field.h - simple field manipulation functions to get students working
6  * with masking. This will be used in the simulator to extract
7  * information when executing an LC3 instruction. It may also be
8  * used in the assembler to "create" the 16 bit LC3 instructions.
9  * If an assignment involving floating point manipulation (e.g.
10  * 16 bit floating point addition), this file can be used to
11  * provide support routines for extracting/setting the sign,
12  * exponent, and mantissa fields.
13  *
14  * "Copyright (c) 2013 by Fritz Sieker."
15  *
16  * Permission to use, copy, modify, and distribute this software and its
17  * documentation for any purpose, without fee, and without written
18  * agreement is hereby granted, provided that the above copyright notice
19  * and the following two paragraphs appear in all copies of this software,
20  * that the files COPYING and NO_WARRANTY are included verbatim with
21  * any distribution, and that the contents of the file README are included
22  * verbatim as part of a file named README with any distribution.
23  *
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
25  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
26  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR
27  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
32  * BASIS, AND THE AUTHOR NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
33  * UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
34  */
35 
117 int getField (int value, int hi, int lo, int isSigned);
118 
128 int setField (int oldValue, int hi, int lo, int newValue);
129 
136 int fieldFits (int value, int width, int isSigned);
137 
138 #endif