Write the boolean function as boolean algebra terms

Assignment Help Assembly Language
Reference no: EM131164661

1 Boolean Algebra and Logisim Task

The following truth table describes a Boolean function with four input values X1, X2, X3, X4 and two output values Z1, Z2.

The main result of this task will be a logical circuit correctly implementing this Boolean function in the logisim simulator. Each step as defined in the following sub-tasks needs to be documented and explained.

Step 1: Boolean Algebra Expressions

Write the Boolean function as Boolean algebra terms. First, think about how to deal with the two outputs. Then, describe each single row in terms of Boolean algebra. Finally, combine the terms for all of the single rows into larger terms.

Step 2: Logical circuit in Logisim

Model the resulting Boolean terms from Step 1 in a single Logisim circuit, using the basic gates AND, OR, NOT.

Test your circuit using values from the truth table and document the tests.

Step 3: Optimised circuit

Using the truth table and Boolean algebra terms from Step 1, optimise the function to be able to build a circuit with a smaller number of AND, OR, and NOT gates. Don't use any other gates. You need to use Boolean algebra laws and explain each step of the optimisation.

The goal is to find a circuit that has less gates than the circuit in Step 2. It is not required to find the minimal circuit.

Test your optimized circuit using values from the truth table.

2 A MARIE calculator

In this task you will develop a MARIE calculator application. We will break it down into small steps for you.

Most of the tasks require you to write code, test cases and some small analysis. The code must contain comments, and you submit it as .mas files together with the rest of your assignment. The test cases should also be working, self-contained MARIE assembly files. The analysis needs to be submitted as part of the main PDF file you submit for this assignment.

Note that all tasks below only need to work for positive numbers. If you want a challenge, you can try and make your calculator work for negative numbers, but it's not required to get full marks.

In-class interviews: You will be required to demonstrate your code to your tutor after the submission deadline. Failure to demonstrate will lead to zero marks being awarded to the entire programming part of this assignment.

MARIE integer multiplication and division

Multiplication

Implement a subroutine for multiplication (based on the multiplication code you wrote in the labs - you can use the sample solution as a guideline). Test your subroutine by writing a test program that calls the subroutine with different arguments, and then step through the programs in the MARIE simulator.

You need to submit at least one MARIE file that contains the subroutine and a test case.

Division

The following code is a poor attempt at implementing a division subroutine in MARIE. It contains a number of errors (both in the assembly syntax and in the program logic). Find and fix these errors, and produce a list that documents for each error how you found it and how you fixed it.

Write a test program that calls the subroutine with different arguments, and then step through the programs in the MARIE simulator. Don't try to just re-implement division

- the point of this task is to identify and fix errors in existing code!

Reverse Polish Notation (RPN)

RPN is a notation for arithmetic expressions in which the operator follows the argu- ments. For example, instead of writing 5 + 7, we would write 5 7 +. For more complex expressions, this has the advantage that no parentheses are needed: compare 5 × (7 + 3) to the RPN notation 5 7 3 + ×.

A calculator for RPN can be implemented using a stack, one of the fundamental data structures we use in programming. A stack is just a pile of data: you can only push a new data value to the top of the stack, or pop the top-most value.
To evaluate RPN, we just need to go through the RPN expression from left to right. When we find a number, we push it onto the stack. When we find an operator, we pop the top-most two numbers from the stack, compute the result of the operation, and push the result back onto the stack. Here is a step-by-step evaluation of 5 7 3 + ×:

Note that we read the stack from left to right here, so e.g. after reading the 7, the stack contains the values 5 and 7, with 7 at the top of the stack.

After all operations are finished, the final result is the only value left on the stack.

A stack in MARIE assembly

A stack can be implemented in memory by keeping track of the address of the current top of the stack. This address is called the StackPointer, and we use a label to access it easily:
StackPointer, HEX FFF

In this example, we set the initial stack pointer to address FFF, the highest address in MARIE.

A push operation writes the new value into the address pointed to by StackPointer, and then decrements the stack pointer. A pop operation increments the StackPointer and then returns the value at the address pointed to by the StackPointer. This means that when we push a value, the stack "grows downwards" from the highest address towards 0.

1. Write a sequence of instructions that pushes the values 5, 4, 3 onto the stack and then pops them again, printing each value using the Output instruction. Step through your code to make sure that the StackPointer is decremented and incre- mented correctly, and that the values end up in the right memory locations.

2. Write a program that implements Push and Pop subroutines. Test the subroutines by pushing and popping a few values, stepping through the code to make sure the stack works as expected.

A simple RPN calculator

We will now implement a simple RPN calculator that can only perform a single operation: addition.

We will use the Input instruction to let the user input a sequence of numbers and operators. To simplify the implementation, we will switch MARIE's input field to Dec mode, meaning that we can directly type in decimal numbers. But how can we input operators?

We will simply only allow positive numbers as input values, and use negative num- bers as operators. For this first version, we will use -1 to mean addition.

So to compute 10 + (20 + 30) we would have to enter 10 20 30 - 1 - 1. Of course we could also enter 10 20 - 1 30 - 1 (which would correspond to (10 + 20) + 30). The pseudo code for this simple calculator could look like this:

Loop forever:
AC = Input // read user input
if AC >= 0: // normal number? push AC
else if AC == -1: // code for addition?
X = Pop Y = Pop
Result = X+Y

Output Result // output intermediate result AND

Push Result // push onto stack for further calculations

Note that your calculator doesn't need to do any error checking, e.g. if you only enter a single number and then use the addition operator, or if you enter any negative number other than -1.

Implement this calculator in MARIE assembly. Use the Push and Pop subroutines from the previous task to implement the stack. It is a requirement that your calculator can handle any valid RPN expression, no matter how many operands and operators, and no matter in what order (up to the size of the available memory). I.e., the following expressions should all work and deliver the same result:

1020304050 - 1 - 1 - 1 - 1
1020 - 13040 - 150 - 1 - 1
102030 - 1 - 140 - 150 - 1
1020 - 130 - 140 - 150 - 1

Document a set of test cases and the outputs they produce.

More RPN operations

Of course the previous calculator is quite useless - if there is only one operation, we don't need to use RPN at all. Therefore, the next step is to extend your calculator with support for additional operations:
- Multiplication (code -2)
- Integer division (code -3)
- Subtraction (code -4)
The extended pseudo code would look like this:
Loop forever:
AC = Input // read user input
if AC >= 0: // normal number? push AC
else if AC == -1: // code for addition?
X = Pop Y = Pop
Result = X+Y Output Result Push Result
else if AC == -2: // code for multiplication?
X = Pop Y = Pop
Result = X*Y Output Result Push Result
else if ... // remaining cases follow the same structure

Note that by convention, XY - means X -Y in RPN, and similarly XY/ means X/Y .

As above, test your calculator using different test cases, which you should document in your written submission.

You can submit just one file for the entire extended version.

Verified Expert

The file contains the solutions, screenshots and documentation for the problems given in the assignment. The Question 1 was a Boolean Algebra problem and needed the use of Logisim software to draw and simulate the logic circuit derived by solving the problem. The other questions required solving coding problems using the MARIE simulator. The latest version of MARIE Simulator was used throughout the assignment. Question 2.1.2 was a debugging problem and all debugs were documented in the assembly listing as mentioned in the assignment. The assignment required documenting analysis of the programming problems. It was unclear exactly how to represent the analysis. Have written small abstract like texts as the analysis of all the programming questions.

Reference no: EM131164661

Questions Cloud

Who want the news and your point of view on stamp act : Use the materials you read to write your response, assuming you are living in the time in which the event occurred and are writing to a contemporary audience who want the news and your point of view on it.
Investigate four attacks and provide a short paper : Investigate four attacks and provide a short paper delineating:- The methods and motives associated with each of your selected attacks.
What role management should play in workplace psychology : Explain what role management should play in workplace psychology. Explain how Ayame's cultural background might affect the way she receives feedback. Describe motivation techniques that could be implemented by management to increase Ayame's motivatio..
Algebraically describe this person budget constraint : Suppose someone's utility function takes the form: U = XY Also suppose that this person has an income (I) of $100, and the price of good X is $5 and the price of good Y is $10. How would you algebraically describe this person's budget constraint? If ..
Write the boolean function as boolean algebra terms : Write the Boolean function as Boolean algebra terms. First, think about how to deal with the two outputs. Then, describe each single row in terms of Boolean algebra.
Discusses the industry challenge : Prepare a 5- 10 minute PowerPoint presentation that discusses the industry challenge, the business case and specifics about the RFID system selected or recommended
What should kevin do if anything in this situation : What should Kevin do if anything in this situation? In what ways do culture and religion play into this scenario? Why is there so much attention paid to Kevin and his personal life? Why does he stand out, and why is this a problem
Why do long lags make discretionary policy less effective : What lag in discretionary policy is described in each of the following statements? Why do long lags make discretionary policy less effective?
Create a portrait photograph and create a newsprint collage : Locate a photo portrait by a recognized artist from the online chapter that intrigues you.- Trace the important contours of the shapes within your image.

Reviews

Write a Review

Assembly Language Questions & Answers

  White-collar assembly lines

White collar workers (who may not necessarily be considered high-skilled) are impacted in this case. Call centers and data processing centers are the "white-collar assembly lines" of IT. Accountants, medical transcriptionists, telemarketers, and o..

  Write a function in linux assembly

Write a function in Linux assembly

  Find out the largest number from an unordered array

Write an Assembly Language Program to Find out the largest number from an unordered array of 16 numbers( 8-bit) starting at the location 0500H (offset) in the segment 2000H

  Write an assembly program that will add two inputs together

How to write an assembly program that will add two inputs together?

  Assembly language point-of-view

From an Assembly Language point-of-view, any registers that are touched by a function need to first be preserved and then later restored to their original value when that function ends, if that functions wishes to leave no side-effects after its exec..

  Write an arm assembly function that takes an array

Write an ARM assembly function that takes an array of integers and insures that all entries are positive. Remember the initial integer in the array is at index zero.

  Write a single arm assembly language instruction

Write a single ARM assembly language instruction equivalent to a function that takes in three strings and checks if any are a substring to one another, if so return 1, if not return 0.

  It has three integer parameters, and it is a value-returning

That is, its name is discr , it has three integer parameters, and it is a value-returning procedure.Follow the cdecl protocol and write a short windows32 test-driver program to test the procedure.

  Create a macro named mwriteint

Create a macro named mWriteInt that writes a signed integer to standard output by calling the WriteInt procedure. The argument passed to the macro can be a byte, word, or double word. Use conditional operators in the macro so it adapts to the size..

  Program for huffman compression/decompression

Write a program for Huffman compression/decompression in assembly language that takes the data from input.txt and writes the output in output.txt.

  Define a second byte array to store the frequencies

Write a code block to print the content of chA and write a code block to print the transpose of chA - Write a code block to compute the individual summation per each column, per each row and the overall summation of chA.

  Write an assembly language program using the pep8 assembler

Write an assembly language program using the PEP8 assembler (free download) that corresponds to the following C++ program

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