Review Problem Chap2
Review Problem Chap2
MICROCONTROLADORES Y
Facultad de Ciencias básicas e ingenierías
MICROPROCESADORES
Programa ingeniería electrónica
1.) Write an 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.
START
1
LOC
Dout =1 Dout =0
Y1
Dout =2
Dout =5 Y2
Dout =7 Y3
Dout =3 Z1
Dout =6 Z2
Dout =8 Z3
UNIVERSIDAD DE LOS LLANOS
MICROCONTROLADORES Y
Facultad de Ciencias básicas e ingenierías
MICROPROCESADORES
Programa ingeniería electrónica
START JC LOCAL
OUT 0
OUT 5
OUT 7
JMP START
LOCAL :
OUT 1
OUT 3
OUT 6
OUT 8
JMP START
2.) Write the assembly language program corresponding to the NSC machine code program
seen in Table 2.8.
3.) START:
4.) OUT0
5.) JC START:
6.) OUT 1 :
7.) JC START:
8.) OUT 2
9.) JC START:
UNIVERSIDAD DE LOS LLANOS
MICROCONTROLADORES Y
Facultad de Ciencias básicas e ingenierías
MICROPROCESADORES
Programa ingeniería electrónica
10.) OUT9
11.) 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.
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.
Start: JC LOCAL
OUT 1
OUT X1
OUT X2
OUT X3
LOCAL OUT Y1
OUT Y2
OUT Y3
OUT Z1
OUT Z2
OUT Z3
OUT Z4
JMP Start
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.)
UNIVERSIDAD DE LOS LLANOS
MICROCONTROLADORES Y
Facultad de Ciencias básicas e ingenierías
MICROPROCESADORES
Programa ingeniería electrónica
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.)
El primer cambio es aumentar el número de ubicaciones de memoria de 16 a 32. Esto hace que
el bus de dirección de memoria aumente de 4 bits (24 = 16) a 5 bits (25 = 32). Esto significa que
el contador de programas tiene que aumentar de 4 bits a 5 bits. Finalmente, el tamaño de las
instrucciones debe aumentar en un bit porque el campo de datos de instrucciones JC / JMP
especifica una ubicación, que ahora requiere 5 bits. Así que el nuevo tamaño de memoria es 32
9. What changes have to be made to the NSC (Figure 2.7) to accommodate a maximum of eight
instructions instead of four?
El campo de código de operación debe incrementarse de 2 bits a 3 bits; esto cambia la memoria
de memoria a 16 × 6 a una memoria de 16 × 7 (cada ubicación ahora contiene 7 bits)