Lab2
.pdf
keyboard_arrow_up
School
University of Guelph *
*We aren’t endorsed by this school
Course
2030
Subject
Computer Science
Date
Feb 20, 2024
Type
Pages
23
Uploaded by harikrishans995
Lab Number 2 1
Overview In this lab, we will continue our exploration of the 68000’s ISA by considering some of its data types, data-movement instructions, and arithmetic instructions. Objectives Upon completion of this lab you will be able to: §
Understand how data-movement and arithmetic instructions (MOVE, SWAP, ADD, SUB, MUL, DIV, and EXT) function with different size data, and §
Understand how the flags in the condition-code register (CCR) are updated based on the result produced by different program instructions execution. Preparation Prior to commencing with the lab, you should review your course notes and perform the following reading assignments from your textbook (if you have not already done so): •
Section 2.2.1 (Byte, Word, Longword Operations) •
Section 3.2.1 (MOVE, LEA) •
Section 3.2.2 (ADD, SUB, MULS, MULU, DIVU, DIVS, EXT) •
Section 3.2.4 (SWAP) •
Section 2.2.5 (Condition Code Bits) Data Types and Operations CIS*2030
Lab Number 2
Name: _______________________________________________
Mark:
_____________/70
Lab Number 2 2
Introduction Now that we know how to edit, assemble, run and debug an assembly-language program using Easy68K, we will employ this knowledge as we explore the mechanics of some of the more commonly used data-movement and arithmetic instructions that are part the ISA of the 68000. Part 1: Effects of different data types when moving data between registers Step 1 Review the MOVE instruction described on page 316 of your textbook along with the examples given in Section 2.2.1. Step 2 Download the sample program called Lab2a.X68
from the course website. Step 3 Start Easy68K. Once running, load the file Lab2a.X68 using the File->Open File menu choice. You should see something similar to below. (Remember to properly comment your code.)
Lab Number 2 3
Step 3 Assemble the program, and then invoke the Easy68K simulator. Before running the program, set a breakpoint at the MOVE.B D1,D2
instruction on line 18. This can be done by using your mouse to click on the green dot on the left-hand-side of the window. The green dot will turn red, as illustrated below. Now when you run the program, the simulator will execute all of the instructions up to
the MOVE instruction on line 18. Step 4 Run the program. When prompted in the console window to enter a decimal number, enter the following value: 305419896
10
. Step 5 The simulator should now be stopped at the breakpoint on line 18. What are the 32-bit hexadecimal values in data register D1
through D5
? Record these values in the second column (labeled “Before”) of the table below. [2 points]
Lab Number 2 4
Register Before After D1
D2
D3
D4
D5
Step 6 Now run the program to completion by pressing the run button. Once the program finishes executing, fill in the third column of the table above (labeled “After”) with the new 32-bit hexadecimal values. Questions Now answer the following questions related to the previous program: 1.
Why do data registers D2 and D3
contain different values even though according to the code they appear to be “copies” of D1
? Be precise. [1 point]
2.
Do data registers D3 and D5
contain the same or different values? If they contain the same values, explain why this is given that the assembly-language instructions on lines 19 and 21, respectively, of the listing file appear to be different from one another. Does the assembler make a size assumption? [2 points]
Lab Number 2 5
Part 2: Initializing registers using constant values It is common practice to initialize registers prior to using them. For example, in the previous program, data register D1 was initialized with a 32-bit value entered by the user using the keyboard at runtime. Another common way to initialize registers prior to their first use is by using a MOVE instruction in combination with the immediate
addressing to copy a constant value (specified at assemble time) into the register. Recall from class, an immediate (or constant) value can be specified in an instruction that supports immediate addressing by placing a # before the numeric value. Moreover, numeric values can be specified either in hexadecimal, binary, or decimal by preceding the number with a $, %, or nothing, respectively. During the assembly process, the constant value is stored as part of the machine instruction using one (or two) extension word(s). Step 1 Download the sample program called Lab2b.X68
from the course website. Step 2 Start Easy68K. Once running, load the file Lab2b.X68 using the File->Open File menu choice. You should see something similar to below. (Remember to properly comment your code.)
Lab Number 2 6
This program shows how the previous program (Lab2a.X68) can be adapted so that data register D1 is now initialized with the decimal value 305419896
10
using a MOVE instruction. The # before the decimal value tells the assembler that the value is a constant specified by the programmer, and that the value is expressed in decimal versus binary (%) or hexadecimal ($). Notice that in this program the value to be loaded into D1
is known at assembly time, whereas the value loaded into D1
in the previous program was not known until runtime. Step 3 Assemble the program. Line 11 of the listing file shows the machine code generated for the MOVE instruction used to initialize data register D1. What does the hexadecimal value 12345678
in the machine code represent? [1 point]
Step 4 Now run the program to completion by pressing the run button. Examine the results produced by the program and confirm to yourself that the program produces the same results as the previous program (Lab2a.X68). Questions Now answer the following questions related to the previous program: 3.
Explain why the assembler instruction MOVE.L #305419896,D1 uses a .L
suffix rather than a .W
or .B
suffix. [1 point]
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
(d) The table below shows the ALUcontrol signal of the datapath we discussed in class.
Instruction
Funct
ALU
Орсode
ALUop
ALU action
operation
field
control
Iw
00
load word
XXXXXX
add
0010
Sw
00
store word
XXXXXX
add
0010
beq
01
branch equal
subtract
0110
XXXXXX
R-type
10
add
100000
add
0010
R-type
10
subtract
100010
subtract
0110
R-type
10
AND
100100
AND
0000
R-type
10
OR
100101
OR
0001
R-type
10
set on less than
101010
set on less than
0111
You want to add the bne instruction into the datapath, which already includes the
required hardware for the instruction. Write out the ALUop for bne and how you can
determine whether the bne results in the branch to be taken.
arrow_forward
Enumerationc. Segment Registersd. Data Addressing Modes
arrow_forward
please zoom in to see image
What is the value of EAX and EDX registers after these instructions are executed:
mov eax,
cdq
mov ecx, 3
idiv ecx
arrow_forward
5. Load the register (CL) from the memory location [0500H] then subtract
the content of this register from the accumulator (AL). Correct the result as
a (BCD) numbers .
Let [0500H] = 12H & AL = 3FH
%3D
arrow_forward
Course:
Introduction to MATLAB Programming
Student Number:
180505005
arrow_forward
Project Overview
The objective of this project is to design a 32-bit bi-directional shift register with multi-bit shift
control signal. A shift register is a fundamental digital circuit that moves data to the left or right.
This project introduces a multi-bit shift feature where the shifted amount of bits changes based on
a signal. When the multi-bit shift control signal is active, the shift register performs multi-bit shifts
(e.g., 2-bit, 4-bit or 8-bit shifts) instead of a single-bit shift.
Tasks
Figure 1 shows a 32-bit bidirectional shift regiters with its signal description
Q
Q
Q
Q
Q
Q
Q
Q
Q
DQ
D Q
Data=1
DIR
CLK
SHC
bobobol bod
Data The input Data is equal to 1 [logic high]. This data should be shifted right or left
DIR = Shift Direction Control: For DIR = 0 [Shift Left] and DIR = 1[shift Right]
CLK = Clock signal, any clock can be used from 10 kHz to 1 MHz
SHC = Multi-bit Shift control signal: If SHC = 0 [1-bit shift only], if SHC = 1 [2-bit, 4-bit, or 8-bit shift
based on…
arrow_forward
Describe how the protection and instruction of set architecture is carried out.
arrow_forward
Code, data, and stack segments are separate. Next, identify the register mix used to
address data objects in each segment.
arrow_forward
suppose you’re trying to interface a matrix keyboard connected to a seven segment display, to display the key that you’re pressing onto it.
b) Explain the necessary steps that take place while registering a particular input from the matrix keyboard? (You may or may not use assembly code instructions to support your answer, only the proper explanation should suffice)
Suppose you want to display your cgpa using three seven segment displays.
c) How would you interface the seven segment displays with IC 82c55? (Use your cgpa as an example to differentiate your answers with the others
arrow_forward
Explain the instruction format in detail as per the no. of address in the instruction with examples?
arrow_forward
* data can be directly loaded from address into register using
direct addressing mode
register addressing mode
indirect addressing mode
immdiate addressing mode
arrow_forward
Using the following data definitions:
bytel BYTE
byte2 BYTE
word1 WORD
word2 WORD 3
OFFh, 1, 2
14h
OFFFFh, 1, 2
word3 SWORD 7FFFh, 8000h
word4 SWORD 9000h
dword1 DWORD 10h, 20h, 30h, 40h
dArray DWORD 10 DUP (?)
Write an instruction that moves the lower 8 bits of word2 into the AL register.
arrow_forward
The term addressing modes refers to the way in which the operand of an instruction is specified. The
addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the
operand is actually executed List different types of addressing mode. Explain any two with suitable diagrams
and examples?
arrow_forward
Select the specialized uses of the EFLAGS register.
each flag is a single binary bit
each flag contains 32 bits
includes the instruction pointer
contains status and control flags
arrow_forward
CMPS only
arrow_forward
The loop instructions transfer execution control to another point designated by the instruction pointer.
(ip)
O (ecx) + sign extended 8-bit displacement
(ip) + sign extended 8-bit displacement
O (ip) + unsigned 8-bit displacement
O (ecx) + unsigned 8-bit displacement
arrow_forward
Describe the set architecture's protection and instruction mechanisms.
arrow_forward
Design an 8-bit register file with 10 registers. Design an ALU with AND, OR, XOR, NOT, ADD and SUBTRACT operations that can use the above register file.
arrow_forward
Identify the Offset Register/s needed by the Segment Register to have the Physical Address.
Stack Segment
Extra Segment
arrow_forward
Don't try to use the AI platform or copy anything from other websites, they gave wrong answer. If I see plagiarism I'll give you multiple downvotes this is for sure..
arrow_forward
For each LEGv8 instruction in Exercise 2.9, show the value of the opcode (Op), source register (R_n), and target register (Rd or Rt) fields. For the I-type instructions, shown the value of the immediate field, and for the R-type instructions, show the value of the second source register (Rm).
ADDI X9, X6, #8
ADD, X10, X6, XZR
STUR X10, [X9, #0]
LDUR X9, [X9, #0]
ADD X0, X9, X10
arrow_forward
Q:Non-Volatile Memory includes
PROM (Programmable ROM)
ROM (Read only Memory)
EPROM (Erasable PROM)
EEPROM (Electrically Erasable PROM)
O RAM(Random access memory)
Q: what is the addressing mode
for the following instruction:
LOAD (ABOO), Ri. *
Register Mode
Register Addressing Mode
Immediate Mode
Indexed Addressing Mode
indirect mode
direct mode
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Principles of Information Systems (MindTap Course...
Computer Science
ISBN:9781285867168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Related Questions
- (d) The table below shows the ALUcontrol signal of the datapath we discussed in class. Instruction Funct ALU Орсode ALUop ALU action operation field control Iw 00 load word XXXXXX add 0010 Sw 00 store word XXXXXX add 0010 beq 01 branch equal subtract 0110 XXXXXX R-type 10 add 100000 add 0010 R-type 10 subtract 100010 subtract 0110 R-type 10 AND 100100 AND 0000 R-type 10 OR 100101 OR 0001 R-type 10 set on less than 101010 set on less than 0111 You want to add the bne instruction into the datapath, which already includes the required hardware for the instruction. Write out the ALUop for bne and how you can determine whether the bne results in the branch to be taken.arrow_forwardEnumerationc. Segment Registersd. Data Addressing Modesarrow_forwardplease zoom in to see image What is the value of EAX and EDX registers after these instructions are executed: mov eax, cdq mov ecx, 3 idiv ecxarrow_forward
- 5. Load the register (CL) from the memory location [0500H] then subtract the content of this register from the accumulator (AL). Correct the result as a (BCD) numbers . Let [0500H] = 12H & AL = 3FH %3Darrow_forwardCourse: Introduction to MATLAB Programming Student Number: 180505005arrow_forwardProject Overview The objective of this project is to design a 32-bit bi-directional shift register with multi-bit shift control signal. A shift register is a fundamental digital circuit that moves data to the left or right. This project introduces a multi-bit shift feature where the shifted amount of bits changes based on a signal. When the multi-bit shift control signal is active, the shift register performs multi-bit shifts (e.g., 2-bit, 4-bit or 8-bit shifts) instead of a single-bit shift. Tasks Figure 1 shows a 32-bit bidirectional shift regiters with its signal description Q Q Q Q Q Q Q Q Q DQ D Q Data=1 DIR CLK SHC bobobol bod Data The input Data is equal to 1 [logic high]. This data should be shifted right or left DIR = Shift Direction Control: For DIR = 0 [Shift Left] and DIR = 1[shift Right] CLK = Clock signal, any clock can be used from 10 kHz to 1 MHz SHC = Multi-bit Shift control signal: If SHC = 0 [1-bit shift only], if SHC = 1 [2-bit, 4-bit, or 8-bit shift based on…arrow_forward
- Describe how the protection and instruction of set architecture is carried out.arrow_forwardCode, data, and stack segments are separate. Next, identify the register mix used to address data objects in each segment.arrow_forwardsuppose you’re trying to interface a matrix keyboard connected to a seven segment display, to display the key that you’re pressing onto it. b) Explain the necessary steps that take place while registering a particular input from the matrix keyboard? (You may or may not use assembly code instructions to support your answer, only the proper explanation should suffice) Suppose you want to display your cgpa using three seven segment displays. c) How would you interface the seven segment displays with IC 82c55? (Use your cgpa as an example to differentiate your answers with the othersarrow_forward
- Explain the instruction format in detail as per the no. of address in the instruction with examples?arrow_forward* data can be directly loaded from address into register using direct addressing mode register addressing mode indirect addressing mode immdiate addressing modearrow_forwardUsing the following data definitions: bytel BYTE byte2 BYTE word1 WORD word2 WORD 3 OFFh, 1, 2 14h OFFFFh, 1, 2 word3 SWORD 7FFFh, 8000h word4 SWORD 9000h dword1 DWORD 10h, 20h, 30h, 40h dArray DWORD 10 DUP (?) Write an instruction that moves the lower 8 bits of word2 into the AL register.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Principles of Information Systems (MindTap Course...Computer ScienceISBN:9781285867168Author:Ralph Stair, George ReynoldsPublisher:Cengage LearningSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Principles of Information Systems (MindTap Course...
Computer Science
ISBN:9781285867168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning