Chapter 6 – Making a Calculator

 

You have now learned absolutely everything there is to know (42).  There is no lesson here, just an assignment

 

Assignment

 

The assignment is to make a four function calculator that handles only one digit numbers.

You should use the 15 buttons on the DIO2 board as the digits 0-9 and +, -, X (multiplication), / (division).

Assign each digit / function to whatever button you want.

Use the button on the D2E board as a RST / CLR button.

You can handle erratic input however you want.  That means if people push buttons in an incorrect order, you can print Err on the screen, you can ignore a button, you can come up with anything you want.  You can even have it die a horrible little death (as long as the RST / CLR button reincarnates it).

 

Hints

 

1)      I would use the “CPLD_control” block and modify the Verilog code to contain an “always” block that does something whenever the button registers are not equal to zero.

2)      I would use the 7 segment LEDs, but you can use the LCD.

3)      I would use Verilog as much as possible and the schematic editor as little as possible.