CS代写 COMP-273, Winter 2022, Assignment 2 – cscodehelp代写

COMP-273, Winter 2022, Assignment 2
School of Computer Science Mc
Available On: Feb 3rd, 2022.
Due Date: Feb 16th, 2022, by 11:59 pm

Copyright By cscodehelp代写 加微信 cscodehelp

By handing in your solutions using MyCourses, you declare that you have followed the assignment submission instructions at the end of this assignment. Late policy: 10% off of the total marks, per day late, for up to 2 days. If submitted 48 hrs or more after the deadline, your assignment will not be accepted.
Question 1: Shift Register (25 marks)
Design an 8-bit shift register with output bits A7A6A5A4A3A2A1A0. Each bit Ai is represented by the Q output of a falling edge triggered D flip-flop, which is available in logisim-evolution. The circuit has a clock and it also has the following two selector inputs: S1, S0. The roles of the selector inputs are described in the table below. The timing of the hold, shift right, shift left, or circular shift right operations is controlled by the clock input.
S1 S0 0 0 0 1 1 0 1 1
No shift – hold Shift Left Shift Right Circular Shift Right
The bit that is shifted out, i.e., when you do a shift right or shift left, should be stored in an additional output called Bout. Correspondingly, an input bit Bin should be brought into the space created by the open position, when you carry out a shift operation. A template file has been provided for you called shift.circ, which you can start with and then modify. You are free to use the built in logisim D flip- flops, multiplexors, as well as standard gates (NOT, AND, OR, NAND, NOR, XOR,

XNOR). Explain your design in words in a separate PDF file named q1.pdf, and then include both the q1.pdf and the shift.circ files in your submission. Note that the TA’s will download and test your circuit design.
Question 2: String Manipulation (25 marks)
Write a MIPS program that takes as input a string of text and then does the following.
• Prints the input string.
• Converts all lowercase letters to uppercase. For example a gets converted to A.
• Converts all uppercase letters to lowercase. For example A gets converted to a.
• Prints the manipulated string.
You can assume that the input string will be comprised of words containing only alphabetic characters (a-z,A-Z) and that each word is separated by a single “space” character. The program should be able to handle strings up to 127 characters in length. Use properties of the ASCII code, in particular the manner in which char- acters are represented to solve this problem. Examples of valid input outputs are provided below.
• ThIs Is A TeST STring => tHiS iS a tEst stRING • i LoVe COMP sci => I lOvE comp SCI
• MiPS is tHE BEST => mIps IS The best
A template file q2.asm has been provided for you. In this file, you will see that there is a hard-coded input string and there is a place for the output string. You can keep the input string as hard-coded for this example. You do not need to provide a version where the user has to type the input string via I/O. When testing your code, the TA’s might modify the contents of the hard-coded input string. However, you can assume the TA’s will only run your code on valid input strings as defined by the criteria above. You should use the space allocated for the output string to write in the content of your output. Then, it should be a simple matter to print it.

Question 3: Position Tracking (25 marks)
Oh no! A masked robber has stolen your precious computer while you were working on your COMP 273 assignment. Thankfully, you have a tracker on your computer which captures which direction it is moving in each kilometer.
In this question, you will try to find the final position of your computer so you can retrieve it and submit your assignment on time. Your tracker has output a se- quence of directions in the form of a character array. You notice that the burglar would only travel directly east, directly north, directly south, or directly west, and would only switch directions at kilometer marks. Some examples of your tracker output are provided below.
• E,N,W,S,E,E,S
• N,N,N,S,S,W
Use the provided information to print the final position of your computer in the form (x, y). You can assume you were at (0, 0) when your computer got stolen. You can also assume that moving east by one kilometer corresponds to moving in the positive x direction by 1 unit, moving west by one kilometer corresponds corresponds to moving in the negative x direction by 1 unit, moving north by one kilometer corresponds to moving in the positive y direction by 1 unit, and moving south corresponds to moving in the negative y direction by 1 unit. A template file q3.asm has been provided for you. You are free to implement your work in this file in any way you like. You will see that the tracker array and its size can be hard-coded at the top of this file. Similar to the last question, you can keep the tracker array and its size hard-coded for this example. You do not need to provide a version where the user has to input the tracker array via I/O. You can assume the tracker array will be a byte array containing only values from the set {N, E, S, W }. When testing your code, the TA’s might change the contents of the tracker array as well as its size. However, you can assume the TA’s will only run your code on valid tracker arrays as defined by the criteria above, and will not input a tracker array of size > 30. Examples of valid input outputs are provided below.
• E,N,W,S,E,E,S => (2,−1) • N,N,N,S,S,W => (−1,1)
• E,E,E,E => (4,0)

Question 4: Testing for a Power of 2 (25 marks)
Write a MIPS program that does the following. • Prompts the user to enter an integer input.
• Checks if the input is a power of 2.
• Prints an appropriate message describing if the input is a power of 2 or not.
A template file q4.asm has been provided for you. You are free to implement your work in this file in any way you like. You can assume the user will only input integer numbers in the range [0, 230].
ASSIGNMENT SUBMISSION INSTRUCTIONS
Each student should submit their own unique solution to these questions, electroni- cally, through MyCourses. By handing in this assignment, you declare that the work you are submitting is your own.
1. The circuit you submit must be saved as a logisim-evolution file so we can test it, while the document showing your work should be a PDF file. It is alright to generate a scan of handwritten solutions, provided that your handwriting is clearly legible. If your handwriting is not clear, it is better to type your answers using an editor.
2. The logisim circuit (shift.circ) must run under logisim-evolution, to be graded.
3. Comment your MIPS code in detail. If there are no comments, and the code is incorrect, you will get ZERO marks for that question. If you make any special assumptions if your programs, or if you feel there are ideas that need explanation, describe them in your comments.
4. Proper use of the argument registers, return value registers, and the stack to save variables or to allocate memory when necessary is required if you use procedures. Note that for this assignment it is not strictly required to use procedures, i.e., you can write your code in a single ’main’ program as we saw with early examples of MIPS in the class.
5. Zip your PDF, logisim, and MIPS files into a single file and rename it with your student ID number, e.g., 260763964.zip. Ensure that you use only the .zip format and no other compression software e.g., .rar, .7z, etc.

6. Submit this single compressed file on MyCourses under Assignment 2.
7. Hints, suggestions and clarifications may be posted on the Ed discussion board as questions arise. It is a good idea to check the discussion board, even if you don’t have specific questions.
8. Please use the discussion board sparingly, i.e., think about the problem state- ment carefully first and see if there are relevant posts already.
9. Make sure that you submit a single file (the zipped file), not many files.
10. Once you have submitted your assignment, download the zip file you uploaded and check that it is indeed what you intend us to grade. This step is critical be- cause a non-trivial number of you will submit the wrong zip file, or a corrupted version. You cannot submit a corrected file later, i.e., after the submission deadline and the two day late window has passed.

程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com

Leave a Reply

Your email address will not be published. Required fields are marked *