Part II – Long Form Questions:
1) {20 points TOTAL} Answer the questions below using following logic circuit shown here (note: each inverter has a 1ns propagation delay):
a) {7.5 points} Complete the timing diagram for outputs A, B, and C. Assume each dotted line is spaced 1ns apart. A
Copyright By PowCoder代写 加微信 powcoder
You can use “Draw” or “Insert->Shapes->Lines” in Word, or you can make and complete the timing diagram in CircuitLab.
b) {7.5 points} Implement this circuit using CMOS transistors
c) {1.5 points} Is this circuit combinational or sequential?
This circuit is combinational.
sequential
d) {1.5 points} Looking at the output line: C, what is the purpose of this circuit?
The purpose of this circuit is carrying the input A to next cycle.
e) {1 points} Given your observation of output line C, what is the frequency of this circuit?
f) {1 points} What could you do to this circuit to increase the frequency?
2) {10 points TOTAL}:
a) {5 points} Create a truth table for a combinational logic component that has (3) 1-bit inputs and (1) 1-bit output. The output is 1 if the “number of 1s” at the input is odd. The output is 0 if the “number of 1s” at the input is even. As an example, 3-bit input: 111 would produce a 1 at the output as it has 3 ones. Note: 000 would produce a 0 at the output.
b) {5 points} Implement the truth table from part (a) as a PLA:
c) {1.5 e.c.} Implement this truth table using the smallest number of logic gates:
3) {15 points} The table below shows the contents of a region of User Program Memory in PennSim. First convert the machine instructions you see here to an equivalent sequence of assembly instructions so you can read them. Write your answers directly in the tables below. After you have done this, show what would happen when the program is executed by filling in the second table which shows the state of all of the registers at the start of each instruction cycle. For the register values R0-R7 you only need to fill in the value of the register that has changed from the previous cycle, if any. Keep the PSR in HEX. For R0-R7 you may use either decimal or HEX (but indicate which is which with a leading # or x). Hint: start by looking at the four bit opcode – be careful how you break up the 16 bit fields, one bit can make a big difference.
NOTE: this column is state of the machine when your program begins.
Refer to this column when you execute your first assembly instruction.
4) {15 points} Write an LC4 assembly subroutine that takes 16-bit number as an argument and returns a 0 if the number has an even number of 1’s and a 1 if the number has an odd number of 1’s. As an example, if the input is: 1011 0101 1110 1010, the subroutine will return: 0 because the input has ten #1s in it. Note: x0000 would return a 0.
Here is a pseudocode version of the subroutine:
SUB_EVEN_ODD (num_to_test) {
count = 0 ;
for (i =0 ; i < 16; i++ ) if ( most_significant_bit of num_to_test == 1) { count = count + 1 ; num_to_test = num_to_test << 1 ; return (count MODULO 2) ; As an example of its use, if the subroutine was called as follows: num_to_test = xB5EA ; SUB_EVEN_ODD (num_to_test) ; // returns a 0 in this case Requirements: · You must use R0 to take in the argument and R0 hold the return value · You must write assembly instructions to initialize R0 and “call” your subroutine · You must use labels, your last label must be “END” · You must comment your code, so we can grade it more easily! · Remember the golden rules of the NZP register: when you write something to the register file, the NZP register stores whether that number was negative/zero/positive · Consider the effect of shifting a number one place to the left and the NZP register · The branch instructions have the ability to read the NZP register · Modulo is like division, except it is the remainder instead of the quotient: · 6 divided by 4 = 1, remainder 2. 6 modulo 4 = 2 a) {1 point} List and explain (in the context of the pseudocode) your register assignments first: Based on the requirements, R0 is the argument, means the variable num_to_test Also, we need a register to store the number of count, we load it to R1, We need the third variable to trace which bit we are now, it’s similar to the i in the pseudocode. We also need a variable to store the current bit we check if it’s equal to 1. So here is the register assignment; R0 = num to test, R1 = count, R2 = I , R3 b) {14 points} Write your LC4 assembly program here. Your code must also be commented to explain significant components of your program (points deducted without them). c) Extra Credit {5 points}: Create a new subroutine SUB_EVEN_ODD_EC based on your program from part (b), enhancing it by giving it the following functionality. Have the subroutine take in a second argument: flag, if it equals 1, the subroutine returns not only 0 or 1 (its original functionality in R0), but also returns the count of 1s in ‘num_to_test’ in R6. If flag = 0, then the subroutine behaves as it normally would. SUB_EVEN_ODD_EC (num_to_test, flag) 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com