diff --git a/README.md b/README.md index b87f2d586d9374739c6b56417ec7747d29fb7a7f..02fe9adf7ec31768f6cb8ea6e36385b0fd4a4aed 100644 --- a/README.md +++ b/README.md @@ -25,62 +25,68 @@ make test make clean ``` +**직접 object 파일 생성 및 하나씩 test방법** +```bash +make +./assembler sample_input/?.s //'?' 에 파일 명 입력 +diff -Naur sample_input/?.o sample_output/?.o; //'?' 에 파일 명 입력 +``` + ## 기능 설명 + ### Instruction Set - 상세한 instruction 정보는 /handout/MIPS_Green_Sheet.pdf 를 참고한다 - - **Only instructions for unsigned operations need to be implemented.** (addu, addiu, subu, sltiu, sltu, sll, srl) - - **However, the immediate fields for certain instructions are sign extended to allow negative numbers** (addui, beq, bne, lw, sw, sltui) - - **Only loads and stores with 4B word need to be implemented.** - - **The assembler must support decimal and hexadecimal numbers (0x) for the immediate field, and** *.data* **section.** - - **The register name is always** *“$n”* **n is from 0 to 31.** - - la **(load address) is a pseudo instruction; it should be converted to one or two assembly instructions.** + - unsinged operation에 대한 instruction만 구현 (addu, addiu, subu, sltiu, sltu, sll, srl) + - 단, 특정 instruction에 대한 immediate 필드는 음수가 혀용되도록 확장된 기호로 표시 (addui, beq, bne, lw, sw, sltui) + - 4Byte의 word 형태로 load와 store 구현 + - assembler는 immediate 필드에 대해 10진수 및 16진수와 .data 섹션을 지원 + - 레지스터의 이름은 "$n" 이고 n은 0~31이다. + - la의 경우 pseudo instruction이고, 하나 또는 두개의 assembly instruction으로 변환 할 수 있다. - la $2, VAR1: VAR1 is a label in the data section - - It should be converted to lui and ori instructions. + la $2, VAR1: VAR1은 data section의 주소이다. + - la는 lui와 ori instruction으로 변환된다. - lui $register, upper 16bit address - ori $register, lower 16bit address - - If the lower 16bit address is 0x0000, the ori instruction is useless. + - 만약 lower 16bit address가 0x0000이면 ori instruction은 필요없다. - Case1) load address is 0x1000 0000 - lui $2, 0x1000 - Case2) load address is 0x1000 0004 - lui $2, 0x1000 - ori $2, $2, 0x0004 -###Directives + + +### Directivites + - .text - - indicates that following items are stored in the user text segment, typically instructions - - It always starts from 0x400000 + - 다음 항목들이 user text 세그먼트에 저장되었음을 나타낸다 + - 항상 0x400000 부터 시작한다. - .data - - indicates that following data items are stored in the data segment - - It always starts from 0x10000000 + - 다음 데이터 항목들이 data 세그먼트에 저장됨을 나타낸다. + - 항상 0x10000000 부터 시작한다. - .word - - store n 32-bit quantities in successive memory words + - 연속적인 memory words 에 n 32-bit를 저장 -- You can assume that the .data and .text directives appear only once, and the .data must appear - before .text directive. Assume that each word in the data section is initialized (Each word has an - initial value). In the following figure, we illustrate the memory map used in our projects. +- 그림을 통해 이번 프로젝트에 사용된 메모리 맵을 확인 할 수 있다. + + ### 입력예시 - + ### 출력예시 -The output of the assembler is an object file. We use a simplified custom format. -- The first two words (32bits) are the size of text section, and data section. -- The next bytes are the instructions in binary. The length must be equal to the specified text section -length. -- After the text section, the rest of bytes are the initial values of the data section. +**assembler의 output은 object파일이다.** +- 처음 두 words는 text section과 data section의 크기이다. +- 다음 byte들은 instruction을 binary로 표현한 형태이다. 길이는 지정된 text section의 길이와 같아야한다. +- text section 이후 나머지 byte는 data section의 초기 값이다. The following must be the final binary format: -<text section size> -<data section size> -<instruction 1> -… -<instruction n> \ No newline at end of file + \ No newline at end of file