Counting Occurrences of 5-char files (EOT=5). Q2-1: Derive the program control flow using program constructs (Hint: sequential, condi- tional, and iterative constructs are used), and briefly label the functionality of each construct in your diagram. (15) STI 1011 SR PC offset9 STR 0111 SR BaseR offset6 TRAP 1111 0000 reserved 1101 trapvect8 Figure 1: LC-3 Instruction Table. Q2-2: Convert the program into instructions. Assume that the instruction starts at address x3000, and the starting address of the file is 0x3012. Derive the instruction-level design that matches your program constructs. (Hint: the majority of the assembly is provided in Figure 2. Fill up the rest lines.) (30) Address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 10 x3000 AND 01010010100000 R2 = 0 // initialize counter x3001 DO 100 1 1000010000 R3 M[0x3012] // initial address x3002 TRAP 11 0 00000100011 TRAP 0x23 // input char to RO = x3003 x3004 x3005 x3006 NOT 01 0 010011 x3007 ADD 0 1 0 x3008 ADD O 1 1 R1 = NOT(R1) // subtract char from file from input char for comparison 01001100001 R1 = R1+1 001001000000 R1 = R1 + R0 x3009 x300A x300B x300C DR1 1 0 x300D BR 0 0 x300E UD 0 1 0n 0 0 1 0 x300F ADDO 0 = - M[R3] // char from file 0 1011000000 R1 2p111110110 BRnzp 0x3004 00000000100 RO = M[0x3013] 00000000010 RO 00000100001 TRAP 0x21 1000000100 101 TRAP 0x25 Starting address of file x3010 TRAP 1 1 0 x3011 AND1 1 x3012 x3013 ASCII TÊMPLATE 0 000 0 = RO + R2 // output counter to monitor with TRAP Figure 2: Question 2-(2).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

READ THE ACTUAL INSTRUCTIONS
IF NOT QUALIFIED, PASS THE QUESTION ON TO SOMEONE WHO IS
DO NOT USE CHATGPT, IT WILL MESS UP THE PROBLEM IN AN OBVIOUS WAY AND YOU WILL BE REPORTED

Counting Occurrences of 5-char files (EOT=5).
Q2-1: Derive the program control flow using program constructs (Hint: sequential, condi-
tional, and iterative constructs are used), and briefly label the functionality of each construct in
your diagram. (15)
Transcribed Image Text:Counting Occurrences of 5-char files (EOT=5). Q2-1: Derive the program control flow using program constructs (Hint: sequential, condi- tional, and iterative constructs are used), and briefly label the functionality of each construct in your diagram. (15)
STI
1011
SR
PC offset9
STR
0111
SR
BaseR
offset6
TRAP
1111
0000
reserved
1101
trapvect8
Figure 1: LC-3 Instruction Table.
Q2-2: Convert the program into instructions. Assume that the instruction starts at address
x3000, and the starting address of the file is 0x3012. Derive the instruction-level design that
matches your program constructs. (Hint: the majority of the assembly is provided in Figure 2.
Fill up the rest lines.) (30)
Address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 10
x3000 AND 01010010100000 R2 = 0 // initialize counter
x3001 DO 100 1 1000010000 R3 M[0x3012] // initial address
x3002 TRAP 11 0 00000100011 TRAP 0x23 // input char to RO
=
x3003
x3004
x3005
x3006 NOT
01
0
010011
x3007 ADD 0 1 0
x3008 ADD O
1
1 R1 =
NOT(R1) // subtract char from
file from input char
for comparison
01001100001 R1 = R1+1
001001000000 R1 = R1 + R0
x3009
x300A
x300B
x300C
DR1 1
0
x300D BR 0
0
x300E UD 0
1
0n
0 0
1 0
x300F ADDO 0
=
-
M[R3] // char from file
0 1011000000 R1
2p111110110 BRnzp 0x3004
00000000100 RO = M[0x3013]
00000000010 RO
00000100001 TRAP 0x21
1000000100 101 TRAP 0x25
Starting address of file
x3010 TRAP 1 1 0
x3011 AND1 1
x3012
x3013 ASCII TÊMPLATE 0 000
0
=
RO + R2
// output counter
to monitor with
TRAP
Figure 2: Question 2-(2).
Transcribed Image Text:STI 1011 SR PC offset9 STR 0111 SR BaseR offset6 TRAP 1111 0000 reserved 1101 trapvect8 Figure 1: LC-3 Instruction Table. Q2-2: Convert the program into instructions. Assume that the instruction starts at address x3000, and the starting address of the file is 0x3012. Derive the instruction-level design that matches your program constructs. (Hint: the majority of the assembly is provided in Figure 2. Fill up the rest lines.) (30) Address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 10 x3000 AND 01010010100000 R2 = 0 // initialize counter x3001 DO 100 1 1000010000 R3 M[0x3012] // initial address x3002 TRAP 11 0 00000100011 TRAP 0x23 // input char to RO = x3003 x3004 x3005 x3006 NOT 01 0 010011 x3007 ADD 0 1 0 x3008 ADD O 1 1 R1 = NOT(R1) // subtract char from file from input char for comparison 01001100001 R1 = R1+1 001001000000 R1 = R1 + R0 x3009 x300A x300B x300C DR1 1 0 x300D BR 0 0 x300E UD 0 1 0n 0 0 1 0 x300F ADDO 0 = - M[R3] // char from file 0 1011000000 R1 2p111110110 BRnzp 0x3004 00000000100 RO = M[0x3013] 00000000010 RO 00000100001 TRAP 0x21 1000000100 101 TRAP 0x25 Starting address of file x3010 TRAP 1 1 0 x3011 AND1 1 x3012 x3013 ASCII TÊMPLATE 0 000 0 = RO + R2 // output counter to monitor with TRAP Figure 2: Question 2-(2).
Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY