0% found this document useful (0 votes)
61 views6 pages

Fall 2022 - CS508 - 1 Solved

The document provides instructions for Assignment 1 in the course CS508 – Modern Programming Languages. It discusses orthogonality in programming languages and provides examples of IBM Mainframe and VAX architecture instruction sets. It then presents a multiple step problem to simulate IBM Mainframe instructions and determine the resulting register and memory values. Tables are included to write the final register and memory values.

Uploaded by

anam hanif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views6 pages

Fall 2022 - CS508 - 1 Solved

The document provides instructions for Assignment 1 in the course CS508 – Modern Programming Languages. It discusses orthogonality in programming languages and provides examples of IBM Mainframe and VAX architecture instruction sets. It then presents a multiple step problem to simulate IBM Mainframe instructions and determine the resulting register and memory values. Tables are included to write the final register and memory values.

Uploaded by

anam hanif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CS508 – Modern Programming Languages

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

Lectures Covered: This assignment covers Lectures No. 01 to 08.


Make sure to watch above-mentioned video lectures, read handouts and recommended book.

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;

ADDL oprand1, oprand2

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.

Question Statement Marks


20
You are required to guess the flow of following IBM mainframe instructions and write the
resultant values of registers (i.e., A, B, C, D and E) and memory locations (i.e., x101, x102,
x103, x104 and x105) after the execution in the tables given below;

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

12) ST x102, C // ST = Storing register value in


memory
X102=39
13)
14) A A, x101 // A = Addition of register and memory
A=15+45=60
15) A B, x103 // A = Addition of register and memory
X104=60
16) ST x104, B // ST = Storing register value in
memory
E=7*50=350
17) M E, x105 // M = Multiplication of register and
memory
X105=350
18) ST x105, E // ST = Storing register value in
memory
C=99
AR C, B // AR = Addition of registers
19) AR E, A // AR = Addition of registers
E=360
Finally, write the resultant values;

Registers Values
A 10
B 60
C 99
D 315
E 360

Memory Locations Values


x101 5
x102 39
x103 45
x104 60

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

You might also like