这是一篇美国的MIPS汇编代码代写
Part A: MIPS (General Information)
- Use any text editor to write the MIPS code and QTSPIM/SPIM to run or debug
- Template code is provided to you, make sure you edit that and write your solution in it
- You can assume that input will be well formed
No negative numbers
Only 2 digit numbers
- Possible input range – 0,99 (inclusive)
- Single digit numbers will be prefixed with 0, eg: 04,00,01
Minimum & Maximum
- Input format: <digit><digit>[space]<digit><digit>…[space]<digit><digit>
- Get each digit from the memory (hint: load byte might be useful)
- Convert the character digit to integer (hint: ascii values)
- Once you get both digits, make the number (hint: place values of digits)
- After getting the number, find the minimum & maximum
- Make sure you store your final answers in registers $a0 and $a1
- Submissions will be autograded with the following expected output:
<minimum_number>[space]<maximum_number>
Sorting
- Input format: <digit><digit>[space]<digit><digit>…[space]<digit><digit>
- Get each digit from the memory (hint: load byte might be useful)
- Convert the character digit to integer (hint: ascii values)
- Once you get both digits, make the number (hint: place values of digits)
- Store the numbers on stack (preferably) Implement the bubble sort algorithm (preferably)
- Make sure you store your final sorted array is stored in register $a0
- Submissions will be autograded with the following expected output:
<sorted_number1>[space]<sorted_number2>…[space]<sorted_number10>
Part B: Verilog (General Information)
- Use EDA Playground to write/test your verilog code
- Draw out the circuit first before writing the verilog code
Adder
- Full Adder Truth table
- assign Sum = addend_1 ^ addend_2 ^ Carry_In; // Think about why?
- Then what should be the expression for Carry_Out?
Carry Lookahead Adder
- In ripple carry adder, we are able to do calculations on any specific bit, only if we have finished calculations on all other previous bits.
- This makes the adder run slowly. To improve this, we can calculate the carries simultaneously, before calculating the sums on those bits
Multiplier
- Example:
- For the second multiplicand, if the number on this bit is 0, then we add the previous result by 0. if the number on this bit is 1, then we left shift the first multiplicand, and add it by the previous result.
Testbench
- The codes on the left provide an example of the testbench for the adder
- We can write our adder on the right half
- We can also slightly modify the testbench (on line 17 and line 37), to change it to the testbench for the multiplier