You are on page 1of 5

University Of Bahrain Collage Of Information Technology Department Of Computer Engineering ITCE321 - Computer Architecture

Experiment #1

Introduction to SRC Simulator

Introduction : The first experiment is a tutorial to demonstrate the SRC simulator and for that we will use SRCToolsv3.1.1.jar , which is a java based application. In this experiment we will explore and learn how to use this tool to assemble a simple assembly code. Objectives: The main objectives of this experiment is to introduce the SRC simulator and using it to assemble and execute a program written in assembly language for the SRC. Equipment And Tools: SRCToolsv3.1.1.jar in the main tool to be used ,as mentioned in the introduction it's a java base application , it requires Java Runtime Environment. The SRCToolsv3.1.1.jar is divided into two parts , a SRC assembler and a SRC simulator , each one has different functions, The SRC simulator simulates the SRC microprocessor ,on the other hand the SRC assembler converts the SRC assembly language to binary for SRC microprocessor. Procedure: 1- open the SRC simulator. 2- A window will pop up containing a set of buttons and many text boxes: - top group of boxes represent 32 registers. - second sets of boxes represent the instructions and their locations. - last set represent the memory content. 3- from the buttons click on Edit , a window will show up (Editor) , write the following code in the editor:
sub shl add stop r1, r2, r3 r4, r1, 2 r5, r4, r1

select File -> Save , save the file with any name ending with " .asm " . 4- press Assemble to assemble the previous code , it will generate a file (.lst) that have the instructions with their addresses in hexadecimal and decimal. 5- In case u had any errors , you will notice them in the text filed in the bottom of the Editor , you can edit the code by pressing Show Asm File , you can also view the binary file by clicking on Show Binary File . 6- To Take the code ( Binary file generated previously) to the simulator press on Bin->Sim . 7- The code we assembled requires values for a couple of registers so in the main window enter values for them and pres Step to execute one instruction at a time or press on Run to execute all the instructions at once.

Results And analysis:

- Snapshot for the code and output implemented in the procedure part :
1.Assembling the code 2. Bin-> Sim

3. entering values for r2 , r3

4. final output of r1, r2 ,r3 ,r4 ,r5

Using the SRC Simulator, write the following program that divides the value of a variables x by 3 and place the result in another variable y, where x is the first digit of your StudentID (e.g., StudentID = 20111747, x = 7, y = 2). Run the program and check the output at the memory display. Provide a snapshot of both. .org 0h ; sets the starting address of the data segment x: .dw 1 ; define a variable x of size 1 word (4 bytes) y: .dw 1 ; define a variable y of size 1 word (4 bytes)

.org 100h segment sub r1, r1, r1 times ld r2, x lar r3, divide lar r4, exit divide: addi r2,r2,-3 brmi r4, r2 addi r1, r1, 1 br r3 exit: st r1, y stop

; sets the starting address of the code ; initialize a counter to conut the divison ; r1 = x ;x can be divided more ; increment division times ; end of the division process ; end of code

*from .asm file we know that x in in location 0 and y is in location 4 in the memory

- The following figure shows assembling , moving binary code into the simulator and entering the value of x which is 7 (20103057) with the results.

1. Assembling the code 2. Bin -> sim

3. Value of x=7 at location 0

4. Value of y=2 at location 4

Conclusion: In conclusion , after we have introduced the SRC simulation tool and using it , I ended up with several ideas about the SRC and how it really works , from the assembly language to the list file and finishing up with the binary code which is the only code the SRC can understand. However they way we used to look for a variable in the memory will be a bit challenging if we were dealing with more than two variables or even a long program.