Assemblers are programs to translate an assembly file into a specific machine language. Most of the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assemblers are programs to translate an assembly file into a specific machine language. Most of the compilers and assemblers are written in C language. Since you are familiar with MIPS encoding syntaxes, I designed the following C project: In this project, you will create a simple assembler program for the MIPS assembly language by using C programming language. Your program receives the source code filename (for example mycode.asm), translates each instruction into the machine code(HEX or Binary), and stores them with their associated address in an output file with the same name as the input file but with .obj extension. For Simplicity, only consider the following MIPS instructions: ADD, SUB, AND, OR (R-type) ADDI, ANDI, SLL (I-Type) BEQ, BNE (1-type) J (J-type) The source code in the input file can contain several instructions with different types, The target address of BEG, BNE, and J instructions are determined by labels in the source code. The start Address of the program is 0x00400000 For example consider the following source code .text again: add show: addi andi x1: beq bne sll j $11, $12, $23 $8,$7,-1234 $3,$7,127 $8,$10, show $4,$6,x1 $17,$18,4 again the corresponding output file should contain the following Address and Code columns (only) Codc Basic Address 0x00400000 0x01975030 Add $11,$13,531 0x00400004 0x20e8fb2e addi $8,$7,-1234 0x00400008 0x30e3007fandi $3,$7,127 0x0040000c 0x110afffdbeq $8,$10,-3 0x00400010 0x14860000 bne $4, $6,0 0x00100011 0x00130900 811 $17,410,4 0x00400018 0x08100000j 0x00400000 3: Again: Add 3: show: addi 4: andi 5: beg 6: bne 7: x1: 811 8: j $11,$12,931 $8,$7,-1234 $3,$7,127 $8, $10, show $4,$6,x1 $17,410,4 again Assemblers are programs to translate an assembly file into a specific machine language. Most of the compilers and assemblers are written in C language. Since you are familiar with MIPS encoding syntaxes, I designed the following C project: In this project, you will create a simple assembler program for the MIPS assembly language by using C programming language. Your program receives the source code filename (for example mycode.asm), translates each instruction into the machine code(HEX or Binary), and stores them with their associated address in an output file with the same name as the input file but with .obj extension. For Simplicity, only consider the following MIPS instructions: ADD, SUB, AND, OR (R-type) ADDI, ANDI, SLL (I-Type) BEQ, BNE (1-type) J (J-type) The source code in the input file can contain several instructions with different types, The target address of BEG, BNE, and J instructions are determined by labels in the source code. The start Address of the program is 0x00400000 For example consider the following source code .text again: add show: addi andi x1: beq bne sll j $11, $12, $23 $8,$7,-1234 $3,$7,127 $8,$10, show $4,$6,x1 $17,$18,4 again the corresponding output file should contain the following Address and Code columns (only) Codc Basic Address 0x00400000 0x01975030 Add $11,$13,531 0x00400004 0x20e8fb2e addi $8,$7,-1234 0x00400008 0x30e3007fandi $3,$7,127 0x0040000c 0x110afffdbeq $8,$10,-3 0x00400010 0x14860000 bne $4, $6,0 0x00100011 0x00130900 811 $17,410,4 0x00400018 0x08100000j 0x00400000 3: Again: Add 3: show: addi 4: andi 5: beg 6: bne 7: x1: 811 8: j $11,$12,931 $8,$7,-1234 $3,$7,127 $8, $10, show $4,$6,x1 $17,410,4 again
Expert Answer:
Answer rating: 100% (QA)
To create a simple assembler program for the MIPS assembly language using C you can follow the steps below 1 Read the input MIPS assembly code from th... View the full answer
Related Book For
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley
Posted Date:
Students also viewed these programming questions
-
6. Let N = {1,2} be a society of two individuals. Each individual i has an endowment W; to be spent on a private good and a continuous public good in the amounts of x; and g, respectively. The price...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
The common stock of Fido Corporation was trading at $45 per share on October 15, 2010. A year later, on October 15, 2011, it was trading at $80 per share. On this date, Fidos board of directors...
-
How large would transactions costs have to be as a percentage of the principal to make triangular arbitrage between the exchange rates S$/ = $0.9000/, S$/ = $0.009000/, and S/ = 101.00/ unprofitable?
-
Allie received a $50,000 distribution from her 401(k) account this year that she established while working for Big Stories Inc. Assuming her marginal ordinary tax rate is 24 percent, how much tax and...
-
The accountant for Villegas Company makes the assumptions or performs the activities listed below. Tell which of the following concepts of accrual accounting most directly relates to each assumption...
-
Clare Company is constructing a new warehouse facility. On May 15, 2016, the company issued $2,500,000 short-term notes payable due March 15,2 017, to finance construction of the warehouse. On...
-
Determine whether the following is a source or use of fund (also provide your explanation): A dividend is paid Issue of short-term debt Long-term debt decreased by $1,000,000 Next year's taxes are...
-
We have a digital medium with a data rate of 10 Mbps. How many 64-kbps voice channels can be carried by this medium if we use DSSS with the Barker sequence?
-
If f(X, Y, Z) = XYZ' + Y'. Express f' as a max term expansion. 1. f'M(0, 1, 2, 3, 6) 2. f' M(2, 3, 7) 3. f'M(4, 5, 7) 4. None 5. f'M(0, 1, 4, 5, 6)
-
Consider the following function and graph. f(x) = 4 X x 25 (a) X-5- -10-8 -6 -4-20. 2 4 6 8 10 8 Determine whether f(x) approaches or - as x approaches 5 from the left and from the right. lim f(x)...
-
Beta Construction Ltd . acquired the following property, plant and equipment on January 1 , 2 0 1 5 :ResidualAssetOffice equipmentBuildingDelivery equipmentCost$ 7 5 . 0 0 0 2 0 0 , 0 0 0 2 5 0 , 0 0...
-
Which mathematical / statistical methods are best for Energy consumption data analysis?
-
Spiro Company uses a normal costing job-order system. The following debits/increases (credits/decreases) appeared in Spiro's work-in-process account: September Description Amount 1 Balance $8,000 30...
-
Peter Phelps is a representative for Delta International Machinery and is paid $675 per week plus a commission of 2% on sales. His sales last week were $17,240. (Assume the SDI rate is 1% and that...
-
Exercise 8-8 Petty cash fund with a shortage P2 Waupaca Company establishes a $350 petty cash fund on September 9. On September 30, the fund shows $104 in cash along with receipts for the following...
-
Classify each of the following activities as proper or prohibited under the various consumer statutes you have studied. a. Calling a hospital room to talk to a debtor who is a patient there. b....
-
State the six transaction-related audit objectives.
-
Multiple Choice Questions The following questions deal with liability under the 1933 and 1934 securities acts. Choose the best response. a. Major, Major, & Sharpe, CPAs, are the auditors of MacLain...
-
Identify the primary specific objectives that must be incorporated into the design of audit tests under the Single Audit Act.
-
Find a Hamilton path from vertex \(s\) to vertex \(v\) for each graph in Figure 12.179 or indicate that there is none. W W Graph A Graph B V W Graph C Graph D Figure 12.179 Graphs A, B, C, and D
-
Use Figure 12.185 to determine if the given sequence of vertices is a Hamilton path, an Euler trail, both, or neither. 1. Graph \(A, e ightarrow b ightarrow a ightarrow e ightarrow d ightarrow c...
-
Suppose you have a complete weighted graph with vertices \(N, M, O\), and \(P\). 1. Use the formula \((n-1)\) ! to calculate the number of distinct Hamilton cycles in the graph. 2. Use the formula...
Study smarter with the SolutionInn App