Download presentation
Presentation is loading. Please wait.
1
Keith Carolus and Dr. Alphonce
Smallpond Simulator Keith Carolus and Dr. Alphonce
2
Keith Carolus Senior computer engineering student
keithcarolus.com linkedin.com/in/keithcarolus Previous CSE115/116, CSE341 TA Current CSE379 TA
3
Simulator Developed as a framework for simulating RISC, non-pipelined ISAs Targeting Smallpond ISA, providing assembler and simulator ~2000 lines of code Verbose assembly error reporting Front end interface with view of memory, registers, and current instruction
4
Smallpond Simulator From Linux terminal (Bash): Notes:
> java -jar SmallpondSimulator.jar input_assembly.s mem_cap output_exec Notes: mem_cap: memory capacity in bytes (optional, default 500) output_exec: output executable (optional) May run jar in Eclipse, demo to come
5
Smallpond Assembly Syntax
C/Java-like single line comments, i.e., prefaced by “//” Mnemonics, operands separated by whitespace and/or commas Registers, mnemonics, flags, condition codes all uppercase Labels expected on line of assembly Instructions described in reference manual
6
Registers and Register Aliases
32 registers, R0-R31 Aliases: A0-A3 T0-T7 S0-S5 + and - C+ and C- HP, FP, SP LR0-LR3 PC CPSR
7
Structure of Assembly File
DATA block, optional MAIN subroutine, required e.g. DATA my_block BLOCK 50 MAIN ADDI T0, T0, #1 Demo later
8
Data Section For defining constants 6 types: BLOCK INT HEX BINARY REAL
STRING *** all constants are padded to multiple of 4 bytes
9
Data Section Example my_block BLOCK 50 // a block of memory 50 bytes in size my_block INT 2 // a 32 bit integer of value 2 my_block HEX 0xF // a 32 bit integer of value 15 my_block BINARY 0b1 // a 32 bit integer of value 1 my_block REAL 2.5 // a 64 IEEE-754 standard floating point number of value 2.5 my_block STRING “this is a string” // a variable length string // STRING prefaced by 32 bit integer length in memory
10
How to Load a Data’s Address
2 instructions, ADDI and LUI e.g. ADDI T0, T0, my_data LUI T0, my_data This is very RISC-like
11
End of Execution Denoted by a “NOP” instruction Reason:
We have no operating system to return to :) Suggested: Place NOP at end of MAIN subroutine and always return back to the MAIN subroutine at the end of your program
12
Layout in Memory Low addresses Set SP (end of code segment)
Set HP (end of memory, grows backwards) Set CPSR (jump to code segment) Data segment Code segment (starting with MAIN) Stack ↓ High addresses Heap ↑
13
Beta Release This simulator is ~2000 lines of code Many moving parts
Let me know if you encounter an issue or have any later questions Piazza
14
Questions?
15
Importing JAR as Eclipse project
Main method located in package model.driver, class Driver.java Arguments may be set in “Run configurations...”
16
Immediates Immediate values are prefaced by ‘#’ and may be:
Integer, e.g., #1 Hexadecimal (prefaced by 0x), e.g., #0xF Binary (prefaced by 0b), e.g., #0b1010 Example of usage: ADDI T0, 0, #0xAB
17
STRING Data Type Note that strings are interpretted literally
i.e. there are no escaped characters
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.