Fall 2022 - CS508 - 1 Solved
Fall 2022 - CS508 - 1 Solved
Assignment No. 01
Total Marks: 20
Bc190206370
Due Date: 08-Dec-2022
Muhammad Uzair
Semester: Fall 2022
Please read the following instructions carefully before solving and submitting assignment.
Uploading Instructions:
You are supposed to consult recommended book(s) to clarify your concepts as
handouts are not sufficient.
The assignment file must be a Microsoft Word file. Any other software/tool is not
allowed.
The required file format is .doc or .docx. Any other format like scan images, txt,
pdf, png, jpeg, jpg etc. will not be accepted.
Place all solutions in a single Microsoft Word file with your own Student ID
written at the top of the file.
Submit the Microsoft Word file at VULMS within the due date.
Rules for Marking:
It should be cleared that your assignment will not get any credit if:
The assignment is submitted after due date.
The assignment is not submitted in .doc or .docx format.
The submitted assignment does not open or file is corrupt.
The assignment is fully or partially copied from other student or ditto copy from
handouts or Internet; strict disciplinary action will be taken in this case.
The submitted file does not contain your own Student ID, or contain other than yours;
Zero Marks will be awarded, and no excuse will be accepted in any case.
Note:
No assignment will be accepted after the due date via email in any case (whether
it is the case of load shedding or internet malfunctioning etc.). Hence refrain from
uploading assignment in the last hour of deadline.
It is recommended to upload solution file at least one day before its closing date.
Do not put any query on MDB regarding this assignment, if you have any query
then email at [email protected]
1
CS508 – Modern Programming Languages
Assignment No. 01
Total Marks: 20
Bc190206370
Due Date: 08-Dec-2022
Muhammad Uzair
Semester: Fall 2022
Orthogonality:
In order to make a programming language easier to learn, read and write programs,
Orthogonality plays a vital role. Orthogonality addresses how relatively small number of
components that can be combined in a relatively small number of ways to get the desired
results. It is closely associated with simplicity; the more orthogonal the design, the fewer
exceptions.
As discussed in video lectures, IBM Mainframe has two different instruction sets; Register to
Register and Register to/from Memory. For example, "to add values of two registers and
store result in first register" the following command is used;
AR Reg1, Reg2
Here;
AR = Command to add values of two registers
Reg1 = Name of first register
Reg2 = Name of second register
Moreover, the following command is used "to add values of a register and a memory
location and store result in register".
A Reg1, memory_cell
Here;
A = Command to add values of a register & a memory cell
Reg1 = Name of a register
Memory_cell = Address of a memory location
2
CS508 – Modern Programming Languages
Assignment No. 01
Total Marks: 20
Bc190206370
Due Date: 08-Dec-2022
Muhammad Uzair
Semester: Fall 2022
On the other hand, VAX architecture has one instruction set for both types (i.e., register to
register and register to/from memory). For example, "to add values of first operand
(register/memory) and second operand (register/memory) and store result in first operand
(register/memory)" the following command is used;
Here;
ADDL = Command to add values of two operands
operand1 = Name of first operand (i.e.,
register/memory)
operand2 = Name of second operand (i.e.,
register/memory)
Since VAX architecture contains only one instruction set, so it is more Orthogonal as
compared to IBM Mainframe.
Now, keeping in view the above discussion, you must answer the following question.
Suppose A, B, C, D and E are registers and initially contain the following values;
A = 2
B = 3
C = 4
D = 5
E = 7
3
CS508 – Modern Programming Languages
Assignment No. 01
Total Marks: 20
Bc190206370
Due Date: 08-Dec-2022
Muhammad Uzair
Semester: Fall 2022
And x101, x102, x103, x104 and x105 are the memory locations, which contain the following
values;
x101 = 10
x102 = 20
x103 = 30
x104 = 40
x105 = 50
Now examine the flow of following IBM instructions (as guided in above discussion);
1) AR A, B // AR = Addition of registers
A=5
2) MR B, A // MR = Multiplication of registers
B=15
3) A C, x101 // A = Addition of register and memory
4+10=14
4) A C, x102 // A = Addition of register and memory
C=34+5=39
5) AR C, A // AR = Addition of registers
X101=5
6) SR C, D // SR = Subtraction of registers
C=39-5=34
7) ST x101, A // ST = Storing register value in
memory
X101=5
8) A D, x104 // A = Addition of register and memory
D=45
9) ST x103, D // ST = Storing register value in
memory
X103=45
10) MR D, E // MR = Multiplication of registers
D=315
11) AR C, A // AR = Addition of registers
C=34+5=39
4
CS508 – Modern Programming Languages
Assignment No. 01
Total Marks: 20
Bc190206370
Due Date: 08-Dec-2022
Muhammad Uzair
Semester: Fall 2022
Registers Values
A 10
B 60
C 99
D 315
E 360
5
CS508 – Modern Programming Languages
Assignment No. 01
Total Marks: 20
Bc190206370
Due Date: 08-Dec-2022
Muhammad Uzair
Semester: Fall 2022
x105 350
Good Luck