Commit 75331da8 authored by Sang-Hoon Kim's avatar Sang-Hoon Kim
Browse files

Revised sentences

parent 99002c8d
......@@ -13,7 +13,7 @@ Translate MIPS assembly code into corresponding MIPS machine instructions.
- The framework gets a line of input from CLI, makes it to lowercase, and calls `parse_command()`. After getting the number of tokens and `tokens[]` as of PA0, the framework calls `translate()` function with them. Write your code in the function to translate the tokenized assembly and return a 32-bit MIPS machine instruction.
- The translator should support following MIPS assembly instructions.
- The translator should support following MIPS assembly instructions. Look up the MIPS reference sheet to find the format for each instruction.
| Name | Opcode / opcode + funct |
| ------ | ----------------------- |
......@@ -34,15 +34,15 @@ Translate MIPS assembly code into corresponding MIPS machine instructions.
| `bne` | 0x05 |
- R-format instructions are inputted as follow:
- The input for R-format instructions will be as follows;
```
add s0 t1 gp /* s0 <- t1 + gp */
sub s4 s1 zero /* s4 <- s1 + zero */
sll s0 s2 3 /* s0 <- s2 << 3. shift amount comes to the last */
sra s1 t0 5 /* s1 <- t0 >> 5 w/ sign extension */
sll s0 s2 3 /* s0 <- s2 << 3. shift amount comes last */
sra s1 t0 5 /* s1 <- t0 >> 5 with sign extension */
```
- I-format instructions are the similar
- I-format instructions are the similar;
```
addi s1 s2 0x16 /* s1 <- 0x16(s2). Immeidate values and address offset
come to the last */
......@@ -51,13 +51,13 @@ Translate MIPS assembly code into corresponding MIPS machine instructions.
registers contain the same value */
```
- The machine has 32 registers and they are specified in the assembly as follow;
- The 32 MIPS registers are specified in the assembly as follow;
| Name | Number |
| ------ | ------ |
| zero | 0 |
| at | 1 |
| v0, v1 | 2-3 |
| v0-v1 | 2-3 |
| a0-a3 | 4-7 |
| t0-t7 | 8-15 |
| s0-s7 | 16-23 |
......@@ -68,7 +68,7 @@ Translate MIPS assembly code into corresponding MIPS machine instructions.
| fp | 30 |
| ra | 31 |
- `shamt` and immediate values are inputted as either (1) decimal numbers without any prefix or (2) hexadecimal numbers with `0x` as its prefix. Followings are the examples
- `shamt` and immediate values are inputted as either (1) decimal numbers without any prefix or (2) hexadecimal numbers with `0x` as its prefix. Followings are the examples. Check the Hints/Tips section.
```
10 /* 10 */
-22 /* -22 */
......@@ -76,24 +76,12 @@ Translate MIPS assembly code into corresponding MIPS machine instructions.
-0x42 /* -66 */
```
- Unspecified register and `shamt` parts should be all 0's. For example, `shamt` part should be 0b00000 for `add` instruction. Likewise, `rs` part should be 0b00000 for `sll` instruction.
- Unspecified register and `shamt` parts should be all 0's. For example, the `shamt` part in `add` instruction should be 0b00000. Likewise, `rs` part should be 0b00000 in `sll` instruction.
### Example
```
*********************************************************
* >> SCE212 MIPS translator v0.01 << *
* *
* .---. *
* .--------. |___| *
* |.------.| |=. | *
* || >>_ || |-- | *
* |'------'| | | *
* ')______('~~|___| *
* *
* Spring 2022 *
*********************************************************
...
>> add t0 t1 t2
0x012a4020
>> addi sp sp -0x10
......@@ -111,7 +99,7 @@ Translate MIPS assembly code into corresponding MIPS machine instructions.
- You can use any standard C library functions such as `strlen` and `strcpy`. However, Windows-specific functions are banned and it will make a compile error on the server.
- *Bit masking* might be your PA-saver. Search the Internet for the concept and try to leverage them in your implementation. You will find bit shifting and bitwise AND/OR are very useful in implemeting this PA. Of course, you don't have to use them if you want to.
- *Bit masking* might be your saver. Learn the concept through Internet search and try to leverage them in your implementation. You will find bit shifting and bitwise AND/OR are very useful and make this PA easy. Of course, you don't have to use them if you don't want to.
- The C syntax allows to use `0b` and `0x` prefix to directly specify a binary/hexadecimal number.
- `int x = 0b1010 + 0xdead0011;`
......@@ -139,4 +127,5 @@ Translate MIPS assembly code into corresponding MIPS machine instructions.
- NO MORE THAN ***THREE*** PAGES
- Please, do not literally read C code nor paste a screenshot of it. If you cannot explain your implementation without showing it, it means that something is not right in the way of your code writing or code explanation.
- THE INSTRUCTOR WILL NOT DEBUG YOUR CODE. TAKE CARE OF YOUR CODE YOURSELF.
- WILL NOT ANSWER THE QUESTIONS ABOUT THOSE ALREADY SPECIFIED ON THE HANDOUT.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment