Simplify this logical expression: A(A + B'D)((A'B')' + C)
A
What type of a data structure is a “stack”? FIFO or LIFO?
LIFO
How many accesses to memory are made during the processing of a TRAP instruction? Assume that the instruction is already in the IR.
1
Suppose we have a symbol called LABEL at line x5004. (x5004: LABEL .fill x0001) What is the result of the following 2 instructions?
LD R0, LABEL
LEA R1, LABEL
R0 = x0001, R1 = x5004
Show that a NOR gate is logically complete. (i.e. show that you can implement a NOT gate, AND gate, and OR gate using only NOR gates.)
Given the code snippet below, your task is to complete the missing boxes below with one instruction per box to swap A and B like shown in the figure.
Consider the following program. What output does the program generate when executed if the user types the key “1” on the keyboard?
111111111...
A byte addressable memory has 6 address bits. What is the addressability, address space, and total number of bytes that it can store?
Addressability = 8 bits
Address space = 2^6 = 64
Total number of bytes = 64
Using only a 4-to-1 MUX, implement the following equation: F = AB + A'B + A'B'C
Refer to the keyboard interrupt service routine below. You may assume that the main program is in an infinite loop, doing nothing. The ISR uses a linked-list to accomplish a task.
(i) Describe what the code does in 20 words or less.
Prints out nodes in the linked-list that have user input as substring.
During the execution of Program A (instruction at x302F) device B interrupts. During the execution of the ISR for device B (instruction at x4004), device C interrupts. Show the execution flow of the interrupt driven I/O using arrows. The first arrow is marked for you. In addition, show the contents of the supervisor stack, with the position of R6 clearly marked after each relevant step. The contents of the supervisor stack right after the ISR for device B is invoked is shown.
Note the priority levels (PL) of the I/O devices and Program A are indicated in the figure.
yes
Complete the symbol table for the following LC-3 program.
FIRST x5FAB
SECOND x5FAC
THIRD x5FBC
FOURTH x5FC0
Using a 3-to-8 decoder and two OR gates, implement a full adder. The output of the two OR gates should be the sum and carry outputs, respectively. (The inputs are A, B, and C. The result should be A + B + C.)
We are creating a new TRAP instruction: GETS. It will be implemented at x0520 and has the TRAP vector number x26. GETS (Get String) will read and echo characters from the screen until it echoes an Enter (ascii x0A). The user input string will be stored at memory locations starting at R0 at the time the TRAP instruction is called (similar to the input argument for PUTS). For example, if the user runs the following code then types in “Hello, world!” and enter, then the code should halt with the null-terminated string “Hello, world!” stored in the locations beginning at the “INPUT” label.
R7
R0
R0
R1
-10
NP
-1
R7
The following program has errors. List the errors and determine in which pass of the assembler these errors will be detected.
An ECE faculty member is tired of the many light switches for the ceiling lights in her classroom. She would like to simplify the setup, and so she proceeds to redesign the light control circuit. In her design, there are only 2 light switches (both are pushbutton switches): the first (SW1) that controls the lights in the front-half of the classroom, and the second(SW2)that controls the back-half of the classroom. If a set of lights is off and the corresponding switch is clicked once, then the lights will be turned on. If the set of lights is on and the corresponding switch is clicked, then the lights will go off. (Hint: there are 4 different combinations that both sets of lights can be in.)
Write an assembly language code (using only the instructions above) for calculating the expression below. The values u, v, w, and x are stored in memory locations U, V, W, X
((u + v)*(u – v)/(w + x))
PUSH W
PUSH X
ADD
PUSH U
PUSH V
ADD
PUSH V
PUSH U
SUB
MUL
DIV
There are generally two different approaches we talked about in class when dealing with I/O: Polling vs. Interrupt. Now, let’s use the program below as a driving example to understand them more deeply.
Write a subroutine MODULO in LC-3 assembly that implements the modulo operator for two positive numbers -- i.e., for inputs N and K, your program will return the remainder after division of N by K. For instance, 5 MODULO 2" would evaluate to 1 while "9 MODULO 3" would evaluate to 0. The subroutine MODULO takes its input arguments from registers R0 and R1; it returns the result in register R2. Specifically, the DIVIDEND (i.e., the number N) is passed through register R0 and the DIVISOR (i.e., the number K) is passed using register R1. The output (N Modulo K) is placed in register R2. For example, if the inputs in R0 and R1 are x000F and x0004, respectively, then the result in R2 is x0003 (i.e., 15 Modulo 4 = 3).