Address symbols with their decimal equivalent value

Assignment Help Computer Engineering
Reference no: EM131950608

Assignment

Description:

Write an assembler for the following instructions:

add, li, lw, sw, move, la, slt, bne, j

Assume that: all registers are addressed by $register-name (like $s1; see your textbook for range of valid register names and numbers); the end of program is recognized by the .end instruction, the program is loaded into memory at location 0; each label has 1 to 4 characters; there is 1 or more space between the symbols in the program.

The input to your assembler is a text file consists of 1 to 50 assembly instructions. The last instruction is .end. You can write your assembler in any language as long as we are able to test it in the department.

The output of your program is a text file that contains the object code. The object code is represented in hex format.

Your assembler should consist of two passes.

First Pass,

During the first pass, the assembler generates a table that correlates all user-defined address symbols with their decimal equivalent value. The binary translation is done during the second pass. The content of PC (Program Counter) stores the value of the memory location assigned to the instruction or operand presently being processed. The assembler sets this counter to 0 initially. A line of symbolic code is analyzed to determine if it has a label (by the presence of a colon). If the line of code contains a label, it is stored in the address symbol table together with its decimal equivalent number specified by the content of PC. PC is then incremented by 4 and a new line of code is processed.

Second Pass,

Instructions are translated during the second pass by means of table-lookup or other procedures. There are three tables:

1. Pseudoinstruction table.
2. Instruction table.
3. Address symbol table.

The entries of the pseudoinstruction table are for pseudoinstructions such as li and move. Each entry refers the assembler to a subroutine that processes the pseudoinstruction when encountered in the program. The instruction table contains the symbols for the rest of instructions and their related information. PC is initially set to 0. Lines of code are then analyzed one at a time. Labels are neglected during the second pass, so the assembler goes immediately to the instruction field and proceeds to check the first symbol encountered. It first checks the pseudoinstruction table. A match with an entry sends the assembler to the corresponding subroutine. If the symbol encountered is not a pseudoinstruction, the assembler refers to the instruction table. If a match occurs, the instruction is converted to its equivalent machine code by the use of address symbol table (if needed). The implementations of tables 1 and 2 are optional. You must use a hash function for the implementation of Table 3.

Error Diagnostics,

The assembler should check for possible errors in the symbolic program and if there is an error it should print out the proper error message.

Sample Program

main :

li $t0, 5
loop: bne $t0, $zero, end
add $s0, $t0, $t0
move $s1, $s0
sw $s1, 0 ($sp)
lw $s2, 0($sp)
j loop
slt $t0, $s1, $s2
la $t1, loop
end: .end.

Reference no: EM131950608

Questions Cloud

What is current price of bond : if the yield to maturity is 8.3 percent, what is the current price of the bond?
Develop important metrics for operations managers : Develop a listing of what you believe are the most important metrics for operations managers. (Hint: Be sure to consider the triple bottom line.)
The opinions about training versus education : However, there are those who believe that the overall experience has more of a result rather than just focusing on training or education.
Prepare statement of cash flows : Prepare a statement of cash flows for Valium’s Medical Supply Corporation.
Address symbols with their decimal equivalent value : During the first pass, the assembler generates a table that correlates all user-defined address symbols with their decimal equivalent value.
Assuming no liquidity premium-no maturity preferences : Assuming no liquidity premium, no maturity preferences, no default risk, and no changes in the expected real rate of return,
Mortgage-backed securities and government bonds : What was the intent behind the Federal Reserve's purchases of long-term assets such as mortgage-backed securities and government bonds
Define brief summary of the core article : Provide a brief summary of the core article enough to identify four key questions arising from that article which you will research.
The house for the full loan term : Which alternative should the borrower choose assuming he or she will in the house for the full loan term?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Identify modules from cpan that can support a gui

Identify modules from CPAN that can support a graphical user interface (GUI), network protocol, and database adapters.

  Which references cause a page fault

A computer has a page size of 1024 words, 132 virtual pages and only 6 page frames.

  Describes the problem being address

Complete a problem analysis that describes the problem being address, and the benefit this system will have for the coaches and administration of the college. When you make a claim in the opening section be sure to follow up or prove it in the bod..

  What is the final step in determining observability

What is the final step in determining observability if the observability matrix is a square matrix?

  Make use of a constructor to initialize employee information

make use of a constructor to initialize employee information. A payroll program that calculates the employees weekly pay after employee's name, hourly rate, and number of hours worked.

  Design a "clear" button that clears all of the hours worked

make a "Calculate" button to perform the pay calculations for all of the employees.

  Write structured pseudo code describing your preparation

Draw a structured flow chart or write structured pseudo code describing your preparation to go to bed at night. Include at least two decisions and two loops.

  What should susan do to investigate other green market

What should Susan do to investigate other green market opportunities for the hotel? Who do you think Susan should involve in the group of staff to pursue the green program? Why?

  Write a short essay discussing your thoughts on topic

Write a short essay discussing your thoughts about and past experiences with research as well as the topic that you are considering

  What is a good all-purpose sorting algorithm for arrays

What determines whether you should use a quadratic sort or a logarithmic sort? What is a good all-purpose sorting algorithm for medium-sized arrays?

  Develop a prototype of e-commerce website

Electronic Commerce Systems ISY10058 - develop a prototype of e-commerce website for a real or fictional business - develop the website according

  How they are choosen and prioritized by management

how they are choosen and prioritized by management at a strategic level?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd