Homework III variant: Microcontroller postfix task

Task description: Emulate a postfix parser using the Basys MX3 development board.

Postfix notation is also known as Reverse Polish notation

Documentation

  • Title page
  • Declaration of originality
  • Description of the program
    • Program flow
    • List all of the error cases and how they are handled
    • List and describe all error codes
    • List and describe all operation codes
    • Function descriptions (purpose, parameters and requirements for the values passed, returns, side effects)
    • Explain your stack data structure

Requirements:

  • The postfix parser must use a stack to store the working data
  • The stack size is 8 (elements)
  • The test cases are given as text strings. The strings will contain numbers (positive, single-digit) and operations (+ – / *)
  • Must be able to handle addition, subtraction, multiplication and division operations
  • The results of intermediate steps  and the result can be in between -99 and 99. Numbers out of this range must cause an error
  • Negative numbers must show a minus sign before the number itself
  • Errors cases:
    • Must handle stack overflow, underflow, division by 0, improper postfix notation, number range overflows and underflows as errors
    • Uniquely identifiable  error codes must be shown on the 7-segment displays. Used codes must be documented!
    • All of the  LEDs must blink with an interval of 1 second (infinite / until new task is initiated)
    • Initiating a new task must bring the user out of the error state
  • Each step in the calculation must be shown to the user for at least 1 second
    • The number being popped from and pushed to the stack must be shown on the 7-segment displays
    • Operation type must be shown on the LEDs with a unique pattern. Used patterns must be documented!
  • Only a single task may be active at the same time
  • Operations must be repeatable

I/O interaction

  • SW switches – task selector
  • 7-segment displays – forth (SEGM3) segment is reserved for sign only (negative number). The other two segments will show error codes, numbers related to the current operation or the result of the task
  • LEDs – current operation code, error notification
  • Button – initiate selected task

Test cases to assign to the dip switches:

All necessary files for the homework can be found here.

Extra values that can be assigned to the indicators

Deadlines, contact and submitting

The task must be submitted by 08.01.2020.

Send your homework’s to this email: hardi.selg@ati.ttu.ee
Attach your zipped homework folder(.zip) to the email.

You can only test your homework on the class computers and to do so you must send me an email.