Professional Documents
Culture Documents
ACM - Step-By-Step Design and Simulation of A Simple CPU Architecture
ACM - Step-By-Step Design and Simulation of A Simple CPU Architecture
ACM - Step-By-Step Design and Simulation of A Simple CPU Architecture
Architecture
Derek C. Schuurman
Redeemer University College
777 Garner Road East
Ancaster, Ontario, CANADA
dschuurman@cs.redeemer.ca
335
Table 1: Summary of simple ALU operations.
F2 F1 F0 Output
0 0 0 A
0 0 1 B
0 1 0 A+1
0 1 1 B+1
1 0 0 A+B
1 0 1 A-B
Figure 1: Block diagram of a simple ALU. 1 1 0 A AND B
1 1 1 A OR B
336
Figure 3: Block diagram of the control unit.
337
Table 4: JMPC Operation.
JMPC Description
0 Next address loaded from the top 5-bits of
MIR
1 Next address is loaded from MBR (bottom
5-bits of the Memory Byte Register)
338
Figure 5: Sample of a spreadsheet showing a portion of the microprogram listing.
reads the input switches and displays their values (in hex- logic level up to the assembly language level. Designing a
adecimal) on the 7-segment display output. For homework simple CPU from the ground up provides an opportunity to
submissions, students can be asked to hand in their assembly grasp basic computer architecture concepts while students
code and machine language translation along with a print experience the satisfaction of making their own CPU. The
out of the completed CPU with the input/output devices simulation provides many opportunities for further exercises
and program memory. such as adding additional instructions, features and perfor-
mance enhancements to the basic CPU architecture.
3. FUTURE WORK
This simple CPU design provides a foundation for many 5. ACKNOWLEDGEMENTS
possible future enhancements. One obvious enhancement The author would like to thank all the contributors to
is to add support for additional instructions in the micro- the Logisim project for making it available to educators and
program. Some instructions that are conspicuously absent students.
in the instruction set include compare operations and con-
ditional jump instructions. The ALU could be further en- 6. REFERENCES
hanced by adding a more elaborate status register to support
[1] http://ozark.hendrix.edu/~burch/logisim/.
more useful compare operations. Furthermore, the ALU
could be modified to provide an 8-bit integer multiply or [2] Computer science curriculum 2008. http://www.acm.
divide instruction. Moreover, students could be asked to en- org/education/curricula-recommendations, 2008.
hance the architecture by adding an instruction fetch unit Report from the ACM/IEEE Interim Review Task
to independently update the PC register and fetch the next Force.
instructions. Additional enhancements can be explored such [3] S. Brown and Z. Vranesic. Fundamentals of Digital
as adding various stages of pipelining. Logic with VHDL Design. McGraw Hill, second
To give students a glimpse of all the levels of computer edition, 2005.
organization from the digital logic layer up to the assem- [4] C. Burch. Logisim: a graphical system for logic circuit
bly language layer, the students can be guided to make a design and simulation. Journal on Educational
simple two-pass assembler for the CPU they have designed. Resources in Computing, 2(1):516, Mar. 2002.
Logisim has support for a binary text file format that can [5] F. Cady. Microcontrollers and Microcomputers:
be loaded into a ROM block rather than typing in the hex Principles of Software and Hardware Engineering.
codes manually. The assembler could be programmed to Oxford University Press, second edition, 2010.
output an assembled program directly to a binary text file [6] J. L. Hennessy and D. A. Patterson. Computer
that can be read directly into Logisim. The students will Architecture: A Quantitative Approach. Morgan
then be able to write assembly language programs in a text Kaufmann, third edition, 2003.
editor, assemble them them with their assembler, load the [7] I. S. MacKenzie. The 8051 Microcontroller. Prentice
resulting binary code into the program memory block, and Hall, 1999.
then run it on their CPU. [8] M. M. Mano and C. R. Kime. Logic and Computer
Design Fundamentals. Prentice Hall, second edition,
4. CONCLUSIONS 2004.
Logisim is a friendly and simple tool for performing dig- [9] W. Stallings. Computer Organization and
ital logic simulations, yet it is powerful enough to simulate Architecture: Designing for Performance. Prentice
a basic CPU. Using a simulator avoids many of the pitfalls Hall, eighth edition, 2010.
that accompany working with real hardware and allows stu- [10] T. Stanley, V. Chetty, M. Styles, S.-Y. Jung,
dents to focus on understanding basic computer organization F. Duarte, T.-W. J. Lee, M. Gunter, and L. Fife.
concepts. Having students build their own simple CPU has Teaching computer architecture through simulation:
pedagogical value which augments the description of exist- (a brief evaluation of cpu simulators). Journal of
ing industrial CPU architectures. This paper describes a Computing Sciences in Colleges, 27(4):3744, Apr.
sequence of step-by-step assignments that gradually guide 2012.
students to create their own simple CPU simulation. As [11] A. S. Tanenbaum and T. Austin. Structured Computer
each assignment builds on the next, students gain an insight Organization. Prentice Hall, sixth edition, 2013.
into the layers of computer organization from the digital
339