An Emulated Computer with Assembler for Teaching Undergraduate Computer Architecture Timothy Daryl...
-
Upload
mervyn-ball -
Category
Documents
-
view
212 -
download
1
Transcript of An Emulated Computer with Assembler for Teaching Undergraduate Computer Architecture Timothy Daryl...
An Emulated Computer with Assembler for Teaching
Undergraduate Computer Architecture
Timothy Daryl Stanley Mu WangBrigham Young University Hawaii
Presented by
Bill Yurcik/NCSA
Objective
• Demonstrate an 8-bit computer built using a free logic emulation software package* to make very clear to students how:– Digital logic and binary number systems work– How data paths and control paths work– How devices (Memory, ALU, Clock, Multiplexers)
combine to make computers– How a program in memory controls the registers,
memory, ALUs and data paths– How instructions are decoded – How an assembler works
* Multimedia Logic from www.softronix.com
Instruction Format Op Op Op Im Im Im Im Im
PC Mux PC IncInstructions
Adi - Add ImmediateAdm - Add MemoryLmi - Load Mem -> RISom - Save RO -> MemJi - Jump ImmediateJzi - J on Z Im Om - Out Mem ImHlt - Halt
Eight Bit Computer Data Path & Control
LegendData Path
Control Path
Eight Bit Computer
Features of Emulated Computer
• Ability to single step or run from clock
• Text display of instruction to run on next half cycle
• All register, immediate and control line states visible
• Ascii text output
• Memory can contain comments after hex instructions
Limitations
• Data memory and program memory in separate devices to simplify data path
• Limited to eight instructions and 5 bit immediate
• Increment after program counter multiplexer so jump to zero ends up at one
• Absence of a by 8 multiplexer means eight 2 by 1 multiplexers must be used
Sample Program One00 zero (not used)19 Hex for character count in alphabetff Twos complement negative onefe Twos complement negative two (not used)41 ASCII code for letter A
c4 Output from memory location 0444 Load input register from memory location 401 Add I (01) to input register64 Save output register in memory location 04 c4 Output from memory location 0441 load input register from memory location 0122 Add from memory location 0261 Save output register to memory location 02aa Jump if last calculation result was zero to 0a 80 Jump to memory location 00(+1)e0 Halt execution
Data Memory Content
Program Memory Content
Sample Program 2
06 column (size of triangle)03 row (not used in program)00 column step00 row stepff negative one (allows decrementing )00 zero2a symbol "*"0d new line
45 Load input register from memory location 5 (zero)20 Add memory location 0 (column) to input register62 Save result in memory location 2 (column step)63 Save result in memory location 3 (row step)c6 lp1: Output from memory location 6 (symbol "*")44 Load input register from memory location 4 (neg one)22 Add from memory location 2 (column step)62 Save result in memory location 2 (colmn step)a9 Jump on zero to lp2:83 Jump to lp1:23 lp2: Add from memory location 3 (row step)63 Save result in memory location 3 (row step)b6 Jump on zero to :hltc7 Output from memory location 7 (new line)45 Load input register from memory location 5 (zero) 20 Add memory location 0 (column) to input register44 Load input register from memory location 4 (neg one)20 Add memory location 0 (column) to input register60 Save result in memory location 0 (column)45 Load input register from memory location 4 (neg one)20 Add memory location 0 (column) to input register62 Save result in memory location 2 (column step)83 Jump to lp1:eo hlt: Halt
Assembler in Perl.data (Please Input Data for DataMem.) numlet:26d negone:ffh acode:41h .text (Please Input Data for ProgramMem.) omi acode start:lmi acode adi 01d som acode om acode lmi negone adm numlet som numlet jzi stop ji start stop:hlt
Sample input on left
Patterned after the PC-SPIMMIPS assembler
Writes data to files for memories
Conclusions
• 8 bit Computer designed using Multimedia Logic from www.softronix.com
• Files available at http://cs.byuh.edu/links.html • Demonstrates data path and control path• Design and implementation of operation codes
demonstrated• Provided the starting point of many student
design project designs including 16 bit computers
Optional additional material
Scanned Memory to Output Display
Calculator with Binary and Hexadecimal Outputs.
Programmable Calculator
Four Bit Adder
Four Bit ALU
0
2
Result
Operation
a
1
CarryIn
CarryOut
0
1
Binvert
b
1 bit ALU from Fig 4.16 page 236 of Computer Organization and Design by Patterson & Hennessy used in my 4 bit design