hardware.h
Go to the documentation of this file.
1 #ifndef __HARDWARE_H__
2 #define __HARDWARE_H__
3 
4 /*
5  * "Copyright (c) 2012 by Fritz Sieker."
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation for any purpose, without fee, and without written
9  * agreement is hereby granted, provided that the above copyright notice
10  * and the following two paragraphs appear in all copies of this software,
11  * that the files COPYING and NO_WARRANTY are included verbatim with
12  * any distribution, and that the contents of the file README are included
13  * verbatim as part of a file named README with any distribution.
14  *
15  * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
16  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
17  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR
18  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19  *
20  * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
23  * BASIS, AND THE AUTHOR NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
24  * UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
25  *
26  */
27 
45 #include "lc3.h"
46 #include "logic.h"
47 
49 #ifndef HARDWARE_VAR
50 #define HARDWARE_VAR extern
51 #endif
52 
60 
62 void hardware_reset (void);
63 
65 void hardware_load_MAR (void);
66 
68 void hardware_load_MDR (void);
69 
71 void hardware_gate_MDR (void);
72 
74 void hardware_gate_PC (void);
75 
79 void hardware_set_PC (LC3_WORD addr);
80 
82 void hardware_load_IR (void);
83 
86 
90 void hardware_load_REG (int regNum);
91 
96 LC3_WORD hardware_get_REG (int regNum);
106 void hardware_memory_enable (int rw);
107 
111 void hardware_set_mode (int mode);
112 
114 int hardware_get_CC (void);
115 
119 void hardware_set_CC (int val);
120 
133 int hardware_step (instruction_t* inst);
134 
135 #endif /* ifdef __HARDWARE_H__ */