Smallpond Simulator Keith Carolus and Dr Alphonce Keith

  • Slides: 17
Download presentation
Smallpond Simulator Keith Carolus and Dr. Alphonce

Smallpond Simulator Keith Carolus and Dr. Alphonce

Keith Carolus ● Senior computer engineering student ○ ○ keithcarolus. com linkedin. com/in/keithcarolus ●

Keith Carolus ● Senior computer engineering student ○ ○ keithcarolus. com linkedin. com/in/keithcarolus ● Previous CSE 115/116, CSE 341 TA ● Current CSE 379 TA

Simulator ● ● ● Developed as a framework for simulating RISC, non-pipelined ISAs Targeting

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

Smallpond Simulator From Linux terminal (Bash): > java -jar Smallpond. Simulator. jar input_assembly. s

Smallpond Simulator From Linux terminal (Bash): > java -jar Smallpond. Simulator. 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

Smallpond Assembly Syntax ● ● ● C/Java-like single line comments, i. e. , prefaced

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

Registers and Register Aliases ● 32 registers, R 0 -R 31 ● Aliases: ○

Registers and Register Aliases ● 32 registers, R 0 -R 31 ● Aliases: ○ ○ ○ ○ ○ 0 A 0 -A 3 T 0 -T 7 S 0 -S 5 + and CHP, FP, SP LR 0 -LR 3 PC CPSR

Structure of Assembly File ● DATA block, optional ● MAIN subroutine, required e. g.

Structure of Assembly File ● DATA block, optional ● MAIN subroutine, required e. g. DATA my_block BLOCK 50 MAIN ADDI T 0, #1 Demo later

Data Section For defining constants 6 types: ● ● ● BLOCK INT HEX BINARY

Data Section For defining constants 6 types: ● ● ● BLOCK INT HEX BINARY REAL STRING *** all constants are padded to multiple of 4 bytes

Data Section Example my_block BLOCK 50 // a block of memory 50 bytes in

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 0 x. F // a 32 bit integer of value 15 my_block BINARY 0 b 1 // 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

How to Load a Data’s Address 2 instructions, ADDI and LUI e. g. 1.

How to Load a Data’s Address 2 instructions, ADDI and LUI e. g. 1. ADDI T 0, my_data 2. LUI T 0, my_data This is very RISC-like

End of Execution Denoted by a “NOP” instruction Reason: We have no operating system

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

Layout in Memory Low addresses Set SP (end of code segment) Set HP (end

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 ↑

Beta Release ● This simulator is ~2000 lines of code ● Many moving parts

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 kmcarolu@buffalo. edu

Questions?

Questions?

Importing JAR as Eclipse project https: //www. albany. edu/faculty/jmower/geog/gog 692/Import. Export. JARFiles. htm Main

Importing JAR as Eclipse project https: //www. albany. edu/faculty/jmower/geog/gog 692/Import. Export. JARFiles. htm Main method located in package model. driver, class Driver. java Arguments may be set in “Run configurations. . . ”

Immediates Immediate values are prefaced by ‘#’ and may be: ● Integer, e. g.

Immediates Immediate values are prefaced by ‘#’ and may be: ● Integer, e. g. , #1 ● Hexadecimal (prefaced by 0 x), e. g. , #0 x. F ● Binary (prefaced by 0 b), e. g. , #0 b 1010 Example of usage: ADDI T 0, 0, #0 x. AB

STRING Data Type Note that strings are interpretted literally i. e. there are no

STRING Data Type Note that strings are interpretted literally i. e. there are no escaped characters