Project 4 – Building a Simple Calculator
Now that we’ve gone over state machine basics and shown the core of our calculator, we need to look at how we’ll actually implement the calculator. The first issue that will come up is how we store our data in the design. Previously, we used Binary Coded Decimal (BCD) when we were incrementing our values. There was a simple solution presented for the BCD incrementor.
If we wanted to keep the internal data as BCD, we would need to develop a custom BCD adder in the hardware, subtractor, and multiplier. This is a more complicated option than a simple incrementor. Alternatively, we can explore the possibility of keeping our internal representation as binary data, but convert it to decimal to display it. This has the added advantage that we can use the SystemVerilog add, subtract, and multiply operators as is on binary representation and then create a conversion function.
The project files can be found in the following...