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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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