Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE!!! READ THE QUESTION CAREFULLY FIRST, I HAVE LOST MANY QUESTIONS BECAUSE THEY SIMPLY DONT READ THE QUESTION AND GIVE the WRONG ANSWER. THANKS. AND

PLEASE!!! READ THE QUESTION CAREFULLY FIRST, I HAVE LOST MANY QUESTIONS BECAUSE THEY SIMPLY DONT READ THE QUESTION AND GIVE the WRONG ANSWER.

THANKS. AND PLEASE LABEL PROPERLY.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Proiect 2: MIPS SIM on Pvthon For this project, you will work in group to implement a python program, which takes as input a text file containing some MIPS code (represented as machine code in hex), and simulate the running of this program, similar to MARS, and output the results. Your project should eventually show three components: 1) a Python simulator, 2) a number of test cases in MIPS machine code, and 3) a PRPG program in MIPS machine code, where 2) and 3) should successfully run on 1). 1) Specifics for the Python simulator simulator shoul Minimum subset of instructions: .Other allowed instructions that your PRPG might use: .One "special instruction" of your choice, if you decide to pursue the 10pts extra credit *Registers: o addi, addu, sub, slt, and, ori, sll, srl beq, bne, lw, sw o add, slti, sltu, lui, andi, or, xor, xori, j o Needed to be approved by the instructor o $0 (always 0) o $8$23 o PC: starting at 0, increment by 4 Minimum memory address range: o [0x2000, 0x2050] . You can assume all the registers / data memory content are initialized to be 0 * The program will end with the machine code 0x1000FFFF oequivalent to end: beq $0, 0, end Input: . A text file containing a valid MIPS program, represented in hex . (optional) User input indicating various running mode - for example, debug mode (output more info, step-by-step), or regular run (minimum output until the end). Output: .On screen or into a text file, nicely formatted: a) Register content (8 $23, PC) b) Memory content (0x2000-0x2050) c) Instruction Count d) Other helpful info (such as current instruction, etc) 2) Test cases in MIPS machine code - 4 given, 4 by your design 1: test cases for arithmetic instructions addi, addu, sub, slt test case 1A: # 1A 0x20080019 0x2108ffdc 0x01084821 0x01284821 0x00095022 0x010a4822 0x0009502a 0x010a582a 0x1000ffff addi $8, $0, 25 addi $8, $8, -36 #addu $9, $8, $8 #addu $9, $9, $8 #sub $10, $0, $9 #sub $9, $8, $10 #slt $10, $0, $9 #sit $11, $8, $10 fend: beq $0, $0, end . test case 1B: a) Your design - must include all the arithmetic instructions supported by your simulator 2: test cases for logic instructions and, ori, sll, srl . test case 2A: #2A 0x34080019 0x3509abcd 0x340affoo 0x012a5024 0x00094c00 0x3529ef80 0x000958c2 0x000b6042 0x1000ffff #ori #ori #ori #and #311 #ori #srl #srl $8, $0, 25 $9, $8, 0xabcd $10, $0, 0xff00 $10, $9, $10 $9, $9, 16 $9, $9, 0x8F80 $11, $9, 3 $12, $11, . test case 2B: a) Your design - must include all the logic instructions supported by your simulator 3: test cases for branch instructions beq, bne) + arithmetic logic test case 3A: . .asm for 3A #3A 0x20080020 0x3409abcd 0x00094c00 0x3529ef12 0x200a0001 0x00005821 0x012a6024 0x11800001 0x216b0001 0x00094842 0x2108ffff 0x1500fffa 0x1000ffff addi $8, $0, 32 ori $9, $0, 0xabcd s11 $9, $9, 16 ori $9, $9, 0xef12 addi $10, s0, 1 addu $11, so, s0 and $12, $9, $10 bea $12, 0, skip addi $11, $11, 1 srl $9, $9, 1 addi $8, $8, -1 bne 8, $0, loop beq 0, $0, end Loop: skip: end: * test case 3B: a) Your design - must include both beq and bne (and j if your simulator supports it). 4: test cases for memory instructions sw, lw + arithmetic test case 4A: # 4A 0x20082000 0x2009fffe 0xad090000 0xad090004 0xad080008 0x21080014 0xad09fffc Oxad09fff8 0xad080000 0x8dObfff4 0x8d6b0000 0x1000ffff end: beq $0, $0, end .asm for 4A addi $8, $0, 0x2000 addi $9, $0, -2 sw $9, ($8) sw $9, 4 ($8) sw $8, 8 ($8) addi $8, $8, 20 sw $9, -4 ($8) sw $9, -8 ($8) sw $8, ($8) lw $11,-12 ($8) w $11, ($11) . test case 4B: a) Your design - must include both 1w and sw instructions. You should be able to use MARS to help verifying your code. For example, the behavior of 4A can be checked by MARs. You can use MARS to come up with testing programs and derive machine code. This hex list should be the input file (such as mc.txt) of your Python code. In the end, MARS can tell you the content of all the registers, and PC value. Your python code should be able to report the same MARS shows the content of memory, from 0x2000 on, in increment of 4. Your python simulator should be able to keep track from 0x2000 to 0x2050, and produce matching results Instruction Statistics, Version 1.0 Ingo Kofler) Total:12 ALU: 3 Jump:0 Branch: Memory: 8 Other: 0 4 MARS reports the total Instruction Count and instruction statistics. Yours should match. 25% 0% 8% 67% 0% Tool Control Disconnect from MIPS Reset Close 3) PRPG program Similar to project 1, you should compose a MIPS program to produce a sequence of 16 pseudo-random patterns, and evaluate their quality Part A): * Your program should begin with addi $8, 0, to initialize the seed (S0) You can choose among the 7 algorithms to produce S (i+1) from S (i)2, assuming S (i)2 has b31, b30, , b0: . a) drop middle 16 (same as Project 1) b) drop two ends of 8 c) drop upper 16 d) drop upper 16 then flip e) drop upper 16 then mirror lower 16 f) drop odd bits g) drop even bits S(i+l31 b29b27 b25b23b2b19 17 b15 b13 b11 b975 3b1 . Your program should store S0 - S5 in Memory location [0x2010] -[0x204C] Part B): . (new) Your program should compute the average of S0- S15, and store the result in M[Ox200C] . (same as project 1 Bi) Your program should compute the average Hamming Weight of S0 - S15, and store the result in M[0x2000] Project Content (80pts) I) Test cases (40pts) Show the results and screenshots of your python simulator for the following test cases: 1. 2. 3. 4. Arithmetic instructions for 1A and 1B Logic instructions for 2A and 2B Branch instructions for 3A and 3B M emory access instructions for 4A and 4B II) PRPG (40pts) Introduce your project by answer the following questions: Q1: Which level does your project achieve? Which PRPG algorithm did your group choose? Why? (up to 5pts will be given to the group(s) which chose the rarest PRPG algorithm.) Q2: How do you verify the correctness of your python simulator, and PRPG code? What kind of resources (productivity tools, collaboration tools) did your group use to work on this project? Give an example of a bug (either in MIPS or python) that your group found out. Show the results and screenshots of your python simulator for your PRPG code, for the following seed values: SO 19 SO 24 SO 100 SO- 2019 S0 34567 .30 pts for showing the results of Part A correctly, including: PC value -Instruction Count Register Values ($8 - $23) - Memory values M[0x2010] -M[0x204C] containing SO- S15 .10 pts for showing the results of Part B correctly, including: - average of s0 -S15, in M[0x200C)] - average Hamming Weight for S0 - S15, in MI0x20001 III) "special instruction" for faster execution (10 pts extra credit) If you chose to implement a special instruction to lower the Instruction Count, introduce the reason of doing so, its detailed functionality, and encoding format. Working with a special instruction that is not supported by MIPS can be hard to verify- you cannot try it on MARS and see if your result is correct. How did you ensure that the code is correct and the debugging process is easy to handle? Provide a comparison for two versions of the same PRPG algorithms, with and without your special instruction, for the above 6 seeds, to show the difference in Instruction Count. You will need also to attach the two prpg_w_special.txt and prpg_wo _special.txt file in your report and Bb submission. Proiect 2: MIPS SIM on Pvthon For this project, you will work in group to implement a python program, which takes as input a text file containing some MIPS code (represented as machine code in hex), and simulate the running of this program, similar to MARS, and output the results. Your project should eventually show three components: 1) a Python simulator, 2) a number of test cases in MIPS machine code, and 3) a PRPG program in MIPS machine code, where 2) and 3) should successfully run on 1). 1) Specifics for the Python simulator simulator shoul Minimum subset of instructions: .Other allowed instructions that your PRPG might use: .One "special instruction" of your choice, if you decide to pursue the 10pts extra credit *Registers: o addi, addu, sub, slt, and, ori, sll, srl beq, bne, lw, sw o add, slti, sltu, lui, andi, or, xor, xori, j o Needed to be approved by the instructor o $0 (always 0) o $8$23 o PC: starting at 0, increment by 4 Minimum memory address range: o [0x2000, 0x2050] . You can assume all the registers / data memory content are initialized to be 0 * The program will end with the machine code 0x1000FFFF oequivalent to end: beq $0, 0, end Input: . A text file containing a valid MIPS program, represented in hex . (optional) User input indicating various running mode - for example, debug mode (output more info, step-by-step), or regular run (minimum output until the end). Output: .On screen or into a text file, nicely formatted: a) Register content (8 $23, PC) b) Memory content (0x2000-0x2050) c) Instruction Count d) Other helpful info (such as current instruction, etc) 2) Test cases in MIPS machine code - 4 given, 4 by your design 1: test cases for arithmetic instructions addi, addu, sub, slt test case 1A: # 1A 0x20080019 0x2108ffdc 0x01084821 0x01284821 0x00095022 0x010a4822 0x0009502a 0x010a582a 0x1000ffff addi $8, $0, 25 addi $8, $8, -36 #addu $9, $8, $8 #addu $9, $9, $8 #sub $10, $0, $9 #sub $9, $8, $10 #slt $10, $0, $9 #sit $11, $8, $10 fend: beq $0, $0, end . test case 1B: a) Your design - must include all the arithmetic instructions supported by your simulator 2: test cases for logic instructions and, ori, sll, srl . test case 2A: #2A 0x34080019 0x3509abcd 0x340affoo 0x012a5024 0x00094c00 0x3529ef80 0x000958c2 0x000b6042 0x1000ffff #ori #ori #ori #and #311 #ori #srl #srl $8, $0, 25 $9, $8, 0xabcd $10, $0, 0xff00 $10, $9, $10 $9, $9, 16 $9, $9, 0x8F80 $11, $9, 3 $12, $11, . test case 2B: a) Your design - must include all the logic instructions supported by your simulator 3: test cases for branch instructions beq, bne) + arithmetic logic test case 3A: . .asm for 3A #3A 0x20080020 0x3409abcd 0x00094c00 0x3529ef12 0x200a0001 0x00005821 0x012a6024 0x11800001 0x216b0001 0x00094842 0x2108ffff 0x1500fffa 0x1000ffff addi $8, $0, 32 ori $9, $0, 0xabcd s11 $9, $9, 16 ori $9, $9, 0xef12 addi $10, s0, 1 addu $11, so, s0 and $12, $9, $10 bea $12, 0, skip addi $11, $11, 1 srl $9, $9, 1 addi $8, $8, -1 bne 8, $0, loop beq 0, $0, end Loop: skip: end: * test case 3B: a) Your design - must include both beq and bne (and j if your simulator supports it). 4: test cases for memory instructions sw, lw + arithmetic test case 4A: # 4A 0x20082000 0x2009fffe 0xad090000 0xad090004 0xad080008 0x21080014 0xad09fffc Oxad09fff8 0xad080000 0x8dObfff4 0x8d6b0000 0x1000ffff end: beq $0, $0, end .asm for 4A addi $8, $0, 0x2000 addi $9, $0, -2 sw $9, ($8) sw $9, 4 ($8) sw $8, 8 ($8) addi $8, $8, 20 sw $9, -4 ($8) sw $9, -8 ($8) sw $8, ($8) lw $11,-12 ($8) w $11, ($11) . test case 4B: a) Your design - must include both 1w and sw instructions. You should be able to use MARS to help verifying your code. For example, the behavior of 4A can be checked by MARs. You can use MARS to come up with testing programs and derive machine code. This hex list should be the input file (such as mc.txt) of your Python code. In the end, MARS can tell you the content of all the registers, and PC value. Your python code should be able to report the same MARS shows the content of memory, from 0x2000 on, in increment of 4. Your python simulator should be able to keep track from 0x2000 to 0x2050, and produce matching results Instruction Statistics, Version 1.0 Ingo Kofler) Total:12 ALU: 3 Jump:0 Branch: Memory: 8 Other: 0 4 MARS reports the total Instruction Count and instruction statistics. Yours should match. 25% 0% 8% 67% 0% Tool Control Disconnect from MIPS Reset Close 3) PRPG program Similar to project 1, you should compose a MIPS program to produce a sequence of 16 pseudo-random patterns, and evaluate their quality Part A): * Your program should begin with addi $8, 0, to initialize the seed (S0) You can choose among the 7 algorithms to produce S (i+1) from S (i)2, assuming S (i)2 has b31, b30, , b0: . a) drop middle 16 (same as Project 1) b) drop two ends of 8 c) drop upper 16 d) drop upper 16 then flip e) drop upper 16 then mirror lower 16 f) drop odd bits g) drop even bits S(i+l31 b29b27 b25b23b2b19 17 b15 b13 b11 b975 3b1 . Your program should store S0 - S5 in Memory location [0x2010] -[0x204C] Part B): . (new) Your program should compute the average of S0- S15, and store the result in M[Ox200C] . (same as project 1 Bi) Your program should compute the average Hamming Weight of S0 - S15, and store the result in M[0x2000] Project Content (80pts) I) Test cases (40pts) Show the results and screenshots of your python simulator for the following test cases: 1. 2. 3. 4. Arithmetic instructions for 1A and 1B Logic instructions for 2A and 2B Branch instructions for 3A and 3B M emory access instructions for 4A and 4B II) PRPG (40pts) Introduce your project by answer the following questions: Q1: Which level does your project achieve? Which PRPG algorithm did your group choose? Why? (up to 5pts will be given to the group(s) which chose the rarest PRPG algorithm.) Q2: How do you verify the correctness of your python simulator, and PRPG code? What kind of resources (productivity tools, collaboration tools) did your group use to work on this project? Give an example of a bug (either in MIPS or python) that your group found out. Show the results and screenshots of your python simulator for your PRPG code, for the following seed values: SO 19 SO 24 SO 100 SO- 2019 S0 34567 .30 pts for showing the results of Part A correctly, including: PC value -Instruction Count Register Values ($8 - $23) - Memory values M[0x2010] -M[0x204C] containing SO- S15 .10 pts for showing the results of Part B correctly, including: - average of s0 -S15, in M[0x200C)] - average Hamming Weight for S0 - S15, in MI0x20001 III) "special instruction" for faster execution (10 pts extra credit) If you chose to implement a special instruction to lower the Instruction Count, introduce the reason of doing so, its detailed functionality, and encoding format. Working with a special instruction that is not supported by MIPS can be hard to verify- you cannot try it on MARS and see if your result is correct. How did you ensure that the code is correct and the debugging process is easy to handle? Provide a comparison for two versions of the same PRPG algorithms, with and without your special instruction, for the above 6 seeds, to show the difference in Instruction Count. You will need also to attach the two prpg_w_special.txt and prpg_wo _special.txt file in your report and Bb submission

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions