Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

The Stored Program Machine

1. Write a assembly language program for the number sequencing computer that outputs the four
digit sequence 0,2,5,7 if LOC = 0, otherwise output the sequence 1,3,6,8. After a sequence is
finished, loop back to program start. Convert your assembly language program to machine code
starting at location 0.

Código ensamblador:
START:

JC SEC

OUT 0

OUT 2

OUT 5

OUT 7

SEC:

OUT 1

OUT 3

OUT 6

OUT 8

JMP START

Location Machine Label Mnemonic


Code
0 01 0111 START: JC LOC_IS_1
1 10 0000 OUT 0 4 bits out_0
2 10 0010 OUT 2 4 bits out_2
3 10 0101 OUT 5 4 bits out_5
4 10 0111 OUT 7 4 bits out_7
5 10 0001 SEC: OUT 1 4 bits out_1
6 10 0011 OUT 5 4 bits out_5
7 10 0110 OUT 6 4 bits out_6
8 10 1000 OUT 1 4 bits out_1
9 00 0000 JMP START JMP START

2. Write the assembly language program corresponding to the NSC machine code program seen in
table 2.8

Josuat Angeloskowich Ojeda Morales – 161003945


This study source was downloaded by 100000842276532 from CourseHero.com on 02-21-2022 20:35:59 GMT -06:00

https://www.coursehero.com/file/97766775/Review-problem-cap-2pdf/
Codigo ensamblador:
START

OUT 0

JC 0

OUT 1

JC 0

OUT 2

JC 0

OUT 9

JMP START

3. For the NSC, assume that the LOC input is tied to the least significant bit of the DOUT bus. For the
program in Table 2.9, give the location executed and the DOUT value for the first 10 clock cycles.

Cycle Location Comment


1 0 OUT 2, DOUT = 2 = 0b0010 = Lsb = 0
2 1 OUT 5, DOUT = 5 = 0b0101 = Lsb = 1
3 2 JC 5, DOUT = 5 = 0b0101 = Lsb = 1
4 3 OUT 9, DOUT = 9 = 0b1001 = Lsb = 1
5 4 JC 2, DOUT = 9 = 0b1001 = Lsb = 1
6 5 JC 5, DOUT = 9 = 0b0101 = Lsb = 1
7 6 OUT 9, DOUT = 9 = 0b0101 = Lsb = 1
8 7 JC 2, DOUT = 9 = 0b1001 = Lsb = 1
9 8 JC 5, DOUT = 9 = 0b0101 = Lsb = 1
10 9 OUT 9, DOUT = 9 = 0b0101 = Lsb = 1

4. Repeat problem #3, except change the instruction at location #1 to OUT 4.

Josuat Angeloskowich Ojeda Morales – 161003945


This study source was downloaded by 100000842276532 from CourseHero.com on 02-21-2022 20:35:59 GMT -06:00

https://www.coursehero.com/file/97766775/Review-problem-cap-2pdf/
Cycle Location Comment
1 0 OUT 2, DOUT = 2 = 0b0010 = Lsb = 0
2 1 OUT 4, DOUT = 4 = 0b0100 = Lsb = 0
3 2 JC 5, DOUT = 4 = 0b0100 = Lsb = 0
4 3 OUT 4, DOUT = 4 = 0b0100 = Lsb = 0
5 4 JC 0, DOUT = 4 = 0b0100 = Lsb = 0
6 5 OUT 9, DOUT = 9 = 0b0101 = Lsb = 1
7 6 JC 2, DOUT = 9 = 0b0101 = Lsb = 1
8 2 JC 5, DOUT = 9 = 0b1001 = Lsb = 1
9 5 OUT 9, DOUT = 9 = 0b0101 = Lsb = 1
10 6 JC2, DOUT = 9 = 0b0101 = Lsb = 1

5.Assume the number definition is changed to 1-X1X2X3-Y1Y2Y3-Z1Z2Z3Z4, with the local number
as Y1Y2Y3-Z1Z2Z3Z4. How many instructions are required for the NSC to implement this program?

Se necesitan de 12 instrucciones para realizar la NSC, desde el inicio, las instrucciones de salida, los
saltos condicionados y los saltos no condicionados.

6. Modify the schematic of the NSC (Figure 2.7) to add support for a new instruction called INC that
increments the current contents of the output register. Assign this new instruction the binary
opcode 11; the data field is unused. (Hint: Try replacing the output register with an up counter.)

7. Modify the schematic of the NSC (Figure 2.7) so that it can access a memory with 32 instructions.
(Hint: Begin by extending the memory to 32 locations, then trace all of the changes required in the
various components—you may be surprised at the number of modifications caused by this
seemingly minor extension.)

Josuat Angeloskowich Ojeda Morales – 161003945


This study source was downloaded by 100000842276532 from CourseHero.com on 02-21-2022 20:35:59 GMT -06:00

https://www.coursehero.com/file/97766775/Review-problem-cap-2pdf/
Es necesario aumentar la memoria de 16 a 32, por lo que el bus de direcciones de memoria aumenta
de 4 bits a 5. El tamaño de las instrucciones debe aumentar de 2 bits a 3.

8. Assume the NSC has a new instruction called INC (opcode = 11) that increments the contents of
the OUT register; the INC instruction data field is unused. Also assume that the LOC input is tied to
the complement of the DOUT[3] bit (LOC = ~DOUT3). For the program in Table 2.10, how many clock
cycles does it take to reach location 3?

LOC DOUT[3:0] CYCLE


1 0000 1
1 0001 2
1 0010 3
1 0011 4
1 0100 5
1 0101 6
1 0111 7
0 1000 8
0 1000 9

Al novena ciclo de reloj se alcanza la instruccion 3.

9. What changes have to be made to the NSC (Figure 2.7) to accommodate a maximum of eight
instructions instead of four?

Es necesario incrementar los bits del opcode, porque también debe cambiar la memoria a 16x7, lo
que significa que cada ubicación e memoria tiene 7 bits.

Josuat Angeloskowich Ojeda Morales – 161003945


This study source was downloaded by 100000842276532 from CourseHero.com on 02-21-2022 20:35:59 GMT -06:00

https://www.coursehero.com/file/97766775/Review-problem-cap-2pdf/
Powered by TCPDF (www.tcpdf.org)

You might also like