You will implement a logic calculator based on NAND logic.

EE/CS/CPE 3760 Homework 4 – Individual Program Due date: complete individually – due Monday 2/13/17 by 11:59pm to Canvas
You are to write a program in MIPS assembly for use in the SPIM simulator. You will implement a logic calculator based on NAND logic. In logic design, a NAND gate is a “universal gate” – it can be used to implement any logic function. The core of your program will be a function “myNAND”, which will be used to implement other logic functions. Functions to Implement: myNAND • Implement a bit-wise NAND on 32-bit inputs A and B. • Input A will be passed to the function via a0, and B via a1. • The result of the bit-wise NAND will be returned via v0. A NAND B requires a NOT operation. Try to think about how to create NOT functionality using the instructions you have available (there is no NOT in MIPS). This is good practice for Exam #2. Contact Dr. Dingler if you have questions on how to do this. myNAND is the only function where you may use built-in MIPS logic instructions. myOR • Implement a bit-wise OR operation on 32-bit inputs A and B. • Input A will be passed to the function via a0, and B via a1. • The result of the bit-wise OR will be returned via v0. • Implement the OR operation by calling your myNAND function. • You must not use any built-in MIPS logic instructions, only myNAND. myNOR • Implement a bit-wise NOR operation on 32-bit inputs A and B. • Input A will be passed to the function via a0, and B via a1. • The result of the bit-wise NOR will be returned via v0. • Implement the NOR operation by calling your myNAND function. • You must not use any built-in MIPS logic instructions, only myNAND. main • Setup the test case below by loading A and B into registers a0 and a1 • Call each of the functions to test your program (see test case below) • The result of each function will be returned in v0
General Requirements: 1. Your code must be well-commented to receive credit. This means any non-trivial line of code should have an accompanying comment. For examples of appropriate comments, refer to any of the code examples on Canvas. 2. When writing functions, all input parameters must be passed using argument registers (a0-a3) and all return values via the value return registers (v0, v1). 3. Your functions will be calling myNAND – you must save/restore $ra before/after each function call (even though myNAND isn’t calling another function). 4. Test each of your three logic functions using the following hex values for A and B: A B 0xABCDEFED 0xDEADBEEF a. To test, setup A and B in MIPS assembly (don’t perform user I/O). Step through the program and take a screenshot of the “Int Regs” pane in QtSpim that clearly shows the result in $v0 in hex after each function executes. Make sure to label each screenshot (e.g., “A or B”). b. It is not required, but it may be helpful to test with other inputs as well. Hints/Tips: 1. Determine how to represent each logic function using myNAND – draw the logic and wiring, and then think about how to turn that into assembly code (how many function calls are needed, what is the order, what intermediate results are needed?). 2. Some of the logic functions will require multiple calls to myNAND. Make sure to keep track of (and don’t overwrite) any intermediate values. 3. Test incrementally, and backup working versions in case you want to start over. Turning in your solution: 1. Save your code as a .s or .txt file, and name it using the following convention: “first_last_hw4.s”. For example, “aaron_dingler_hw4.s”. 2. Take screenshots of the two test inputs for each logic function, label each function (e.g., “A or B”) and paste into a Word document or PDF Name the document using the following convention: “first_last_hw4.docx”. For example, “aaron_dingler_hw4.docx”. 3. Upload your two files to Canvas. Make sure to upload both files.

Order from us and get better grades. We are the service you have been looking for.