An Emulated Computer With Assembler For Teaching U
An Emulated Computer With Assembler For Teaching U
net/publication/254239001
CITATIONS READS
14 421
2 authors, including:
Timothy D. Stanley
Utah Valley University
25 PUBLICATIONS 207 CITATIONS
SEE PROFILE
All content following this page was uploaded by Timothy D. Stanley on 05 March 2015.
1
Result
b 0 2
CarryOut
These next two projects are designed to understand the Learning outcomes of this project include an appreciation
inner workings of an ALU. The first, shown in figure 4, is of how multiplexers make possible the control path in a
a ripple carry binary adder. Two four-bit values are computer—and again, an appreciation of how gates can be
provided on the hexadecimal key pads and the results of combined to produce computer functions.
the addition are displayed on the seven segment displays.
By inverting the B inputs and making the C input for the 3. An Emulated Computer for Teaching
first stage one the adder can be converted to a subtraction Computer Architecture
unit, illustrating the algorithm for converting a binary
number to its two’s complement negative. Providing a computer that is very well instrumented,
visible on one page and easy to demonstrate, was the main
goal of this design effort. In my computer architecture
classes I ask my students to design an emulated computer.
This design was one I produced to illustrate what I wanted
from my students. I suggested they start with an
instruction set and register design and build a computer
from this foundation. For this eight-bit computer, an
instruction format of three bits of operation code and five
bits of immediate was chosen. This instruction format
provides for eight instructions. These with mnemonics are:
1. adi - Add the immediate value to the input register
and place in the output register,
2. adm - Add memory location addressed by the
immediate to the input register and place in the
output register,
3. lmi - Load the contents of the memory location
Figure 5. Four-bit ALU addressed by the immediate value to the input
register,
The most important learning outcome of this design is an
appreciation for how logic circuits can perform the kinds of 4. som - Save the output register to the memory
operations we see computers perform. location addressed by the immediate value,
5. ji - Jump to the location given in the immediate,
6. jzi - Jump to the location given by the immediate registers and memory are writing enabled. This enables
if the result of the last addition was zero, demonstration of the inputs to commands being set up and
then the operation being executed.
7. om - Output the data from the memory location
addressed by the immediate to the output display One non-physical device available in the logic emulator
device, used is a binary controlled text display. This device can be
seen just below the vertical column of control line
8. hlt - Halt operation.
indicators. This display shows one of sixteen lines of text,
The physical architecture was to use two separate depending on the binary inputs to the device. In this case
memories, to hold the data and program. This parallels the the device is used to show the operation being set up in the
MIPS emulator PC SPIM which has a “.data” segment of computer.
memory holding constant data and a “.text” segment that
The memory devices can be used as read-only devices
contains the machine instructions. This construction
reading content from an underlying file, or they can be
simplifies the data path of the computer, but limits the
initialized with a file and altered dynamically during
capability to do recursion. The design includes an input
program execution. For registers memory devices with all
register and an output register.
address lines grounded are used.
This design is a complete eight-bit, single cycle, stored
One limitation of this emulation package is the absence of a
program computer. The data paths are connected at the
2-by-8 multiplexer. As a result the multiplexers are
start of the clock cycle at then at the clock transition
assembled by stacking a series of 1-by-2 multiplexers
4.3 Sample Program 3, Triangle. Table 6. Program memory content for program 3
This program was written to test the assembler discussed in
the next section. It uses two nested loops to print a triangle
********** Operation Code **********
******************************************
********* adi- Add Immediate *********
********* adm- Add Memory *********
********* lmi- Load Mem -> Ri *********
********* som- Save Ro-> Mem *********
********* ji- Jump Immediate *********
********* jzi- J on z Im *********
********* om- Out Mem Im *********
********* Hlt- Halt *********
******************************************