Create a postfix notation calculator that performs

Assignment Help Database Management System
Reference no: EM131258381

Microcontrollers Lab

Lab Objectives

The objective for this lab is to become familiar with the stack. This will be achieved through the simulation of a simple postfix notation (a.k.a., Reverse-Polish Notation or RPN) calculator.

Work Tasks

Step 1

Allocate your stack such that the stack is located in what we defined as the data section of RAM. Remember, we defined our data section with the label "PROG" using the ORG assembler directive. Use the LDS instruction to initialize your stack. Now, load the stack using a loop with the values shown below. After the stack is loaded, use the TSX command to transfer the SP to index register X and then to load accumulator A with $23 and accumulator B with $67 (HINT: take a look at the lecture on stacks).

Figure 3: Stack and its contents.

Step 2

Code the simple postfix notation calculator that performs the operation shown in Figure 4. This calculator will only perform one operation ((35) (5) (-2) + (10)x-(4)+). The infix expression of the operation to be performed is "35 + ((5 + -2) x 10) + 4". Don't worry about saving the operators on the stack. Always push values on the stack. However, when you reach an operator, pull the values off the stack into registers, perform the arithmetic operation, and push the result back on the stack according to Figure 4. Your final result should be 9 ($09) and should be on the top of the stack.

NOTE: the multiply instruction (MUL) multiplies two 8-bit numbers and returns a 16-bit number. In this case, only return the lower 8-bit as the result.

Step 3

Now take the postfix notation calculator a step further. Using a loop, branches, and the stack, create a postfix notation calculator that performs the +, -, x, and / operations, as shown in the example in CALC_IN. Add the variables below to the DATA section of your code. Use these variables to implement your calculator. The operations should be the machine opcode as follows:

+: $8A, -: $8B, x: $8C, and /: $8D. For example, if you want to use ABA to implement +, the value should be $18. Make sure to replace those ??s with what you want to use before you try to use the code. CALC_IN contains the variable with the operation to perform. Use conditional statements and your knowledge of the opcode to determine if there is an opcode, and if so which operation to perform. The values in CALC _IN below are initially 84/2*21+- and the result should be 1. Try another operation of your choosing by changing CALC_IN and discuss it in the methodology section of your report. Keep in mind you won't be able to use any values that are the same as the opcodes you are using, but any other value should work, including negative values.

CALC_IN FCB $08,$04,$8D,$02,$8C,$02,$01,$8A,$8B

HINTS: You will traverse the CALC_IN array in a similar fashion to lab 3. You will jump out of the array when an operator is found, pull two values off the stack, perform that particular operation, push the result onto the stack, and then return to the loop. Otherwise, you will just push the value on the stack.

NOTE: the divide instruction (IDIV) requires two 16-bit registers and returns a 16-bit value.

Only return the lower 8-bit as your result.

What to Turn In (Please read this carefully)

You are to put your code as text and screenshots into the "lab_4_template.docx" in the designated areas. This will be the file that you upload to TITANium as your submission. Provide your code as text, not an image. Points will be deducted if it is an image. You are then to take screenshots of your program in both CodeWarrior and terminal (i.e. on the Dragon board). The screenshot should show the relevant CPU registers and memory locations (NOTE: a convenient way of getting screenshots is to use the "snipping tool"). Do NOT crop the screenshot, for any credit I want a full screen screenshot of your computer screen including the task bar. Also you must answer the questions on the "lab_4_template.docx" file.

Attachment:- Lab_4_Instructions.pdf

Reference no: EM131258381

Questions Cloud

Why is there no original and current plan : Why is there no original and current plan shown for the MTBF TPM - what went wrong with the range performance? As the lead systems engineer, what should you have done to recognize and avert the problem shown by the data in this TPM? And when should..
Discussion of the dependence aspects of the drugs : Select one drug from each classification for an in-depth analysis, which should include at least: the effects of those drugs on the human body, a discussion of the dependence aspects of the drugs, and their interactions with other drugs.
Create the heading and leave a blank section : Give a brief description of your independent variable and dependent variable. Provide the specific hypothesis statement which includes the independent and dependent variable.
Analysis of firm resources, capabilities, and value chain : Need an analysis of Celanese Corporations Resources, Capabilities, and Value Chain. Section 4.2 in this format - Analysis of Firm Resources, Capabilities, and Value Chain
Create a postfix notation calculator that performs : Using a loop, branches, and the stack, create a postfix notation calculator that performs the +, -, x, and / operations, as shown in the example in CALC_IN.
Describe test environment and including hardware requirement : Describes the process of migrating existing data to the testing platform. Describe the test environment, including hardware requirements and the personnel who will participate in user acceptance testing.
Organize the references in alphabetical order : Submit six (6) credible and evidence-based scholarly references for use in the Research Project. Provide a descriptive summary of at least 150 words for each reference. Evaluate the relevance and applicability of each reference to your chosen topic..
How would you organize your department : If you were a police chief, how would you organize your department? For example, would it have many specialized units? What would they be and how would you determine that they were needed? Would your department have fewer or more rules, and why?
Describe how the program effectiveness will be analyzed : Who is your target population, what are your goals, and how will your program be implemented? Explain your program, detailing the elements of it and why it will be effective. Describe how the program's effectiveness will be analyzed and how the objec..

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

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