Not Sure About VW EGR Valve Health Look For These Symptoms
IEEE_Calculator_Verilog2020.pdf
1. See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/347980472
Implementation of Verilog HDL in Calculator Design with FPGA Simulation
Conference Paper · October 2020
DOI: 10.1109/EnCon51501.2020.9299337
CITATION
1
READS
1,352
6 authors, including:
Some of the authors of this publication are also working on these related projects:
Development of Wireless Sensor Network Protocol for Smart Grid Distribution Systems View project
M.Sc. Project Title: Design and Development of a Fault Detection and Protection System for PMU based Digital Substations View project
Shamsiah binti Suhaili
University Malaysia Sarawak
16 PUBLICATIONS 41 CITATIONS
SEE PROFILE
Julai Norhuzaimin
University Malaysia Sarawak
27 PUBLICATIONS 86 CITATIONS
SEE PROFILE
Maimun Huja Husin
University Malaysia Sarawak
18 PUBLICATIONS 77 CITATIONS
SEE PROFILE
All content following this page was uploaded by Shamsiah binti Suhaili on 05 October 2021.
The user has requested enhancement of the downloaded file.
3. into binary form for data processing purposes. The calculator
conducts several sequential operations in their binary form,
such as addition, subtraction, multiplication, division, square
& cube function, square root, and factorial feature [16 - 22].
The data were converted from the asynchronous unit to the
synchronous unit in the push-button section. The calculated
output data in binary form are then translated to BCD format
for the functioning at the seven-segment unit. The
mathematical operations' output results are produced by
lighting up the different positions of the 7-segment LEDs to
display the digit. There are nine sets of 7-segment LED
provided for output. Eight of them represented the number
digits of the calculation result. The other one on the most left
side represented the sign of the number.
Fig. 1. Data type and flow
Figure 2 shows the block diagram of the calculator. The
research development is carried out using Verilog HDL on
Altera Quartus II software. The calculator design is divided
into several essential parts written in several modules in the
Verilog HDL language and activated with the waveform files
and RTL viewers separately. The calculator top module in
this project design is named as ‘calctop’ module. The overall
modules included in this top-level module are ‘calc’,
‘syncro’, ‘syncro10’, ‘binled’, ‘bintobcd’, and ‘ledout’.
All the computational operations and functions are carried
out in this module. From the block diagram, as shown in
Figure 2, inputs from the ‘push’ section are received in the
block ‘dectobin’, which carried out the process of converting
the input data from decimal form to binary form. The
computation of data is carried out in the function
‘DECIMAL’. The binary input data is loaded into this
function to register A. Register A function returns the number
used in the memory. Register B stored the input number
memory for processing purposes on the 7-segment LED
screen. The operators implemented, all clear (AC), clear entry
(CE), add, subtract, multiply, divide, exponential, square
root, factorial, and equal are included in the design.
Fig. 2. Block diagram of the design
In both ‘syncro’ and ‘syncro10’ modules, data in the
synchronous unit is converted from asynchronous unit
to synchronous unit. ‘syncro’ module involves 1-bit
width of data conversion while ‘syncro10’ involves 10-
bit width of data conversion. In the ‘syncro’ and
‘syncro10’ modules, the input data are converted from
the asynchronous unit to the synchronous unit. In the
asynchronous counter, different flip flops are triggered
with the different clock are triggered. While in the
synchronous counter, all flip flops are triggered
simultaneously with the same clock.
After the result in binary form has been computed,
the ‘bintobcd’ module translated the data set in binary
form to BCD format. For the module ‘ledout’, the data
in BCD format is translated to an LED-out format.
‘binled’ module is for the code translation part, which
output the computed data in BCD form to the seven
segments LED provided.
A. The bit width of the register
It is important to evaluate the bit width range of the
registers so that the design of the calculator can perform eight
digit calculations. The bit widths of the registers are decided
according to the number of digits. Since the data inputs for
register A is within 0 to 99999999, which means that 0 to
101111101011110000011111111 in its binary form.
Therefore, the bit width for register A is 27 bits. In register
B, the values of 99999999 add with 99999999 got the total
number of 199999998. The range of values in decimal form
is from -199999998 (-99999999-99999999) to 1999998
(99999999+99999999). When converted the values of
199999998 to its binary form, it is
1011111010111100000111111110, and it has 28 bits.
Formula of the total number of bit width 2 is used. n
represent the number of bits. So 2 = 2 = 268435456.
Decimal of 268435456 convert to binary form
10000000000000000000000000000. Memory address must
be in binary form. The register B has 29 bits.
Authorized licensed use limited to: UNIVERSITY MALAYSIA SARAWAK. Downloaded on January 06,2021 at 08:07:23 UTC from IEEE Xplore. Restrictions apply.
4. B. Overflow
Overflow occurs when the size of the number exceeds the
maximum range of bits allowed in the registers. In this paper,
the inputs must be limited in the range from -99999999 to
99999999, otherwise, overflow. The overflow of the design
is calculated based on the operation of the decimal mode. The
input values must be larger than -99999999, with the signed
binary form of
0000_0101_1111_0101_1110_0000_1111_1111. When
converted to its 2’s complement, the value is
1111_1010_0000_1010_0001_1111_0000_0001. Hence, it
becomes 4194967297 when its 2’s complement binary value
is converted back into decimal form. On the other hand, the
input values must not exceed 99999999 as this is the
maximum value for an eight-digit calculator.
C. Synchronous circuit
Flip flops are made of a latch with enable input and an
edge detector circuit. The input to the edge detector is a signal
called ‘clock’. A clock signal is a square wave with a fixed
frequency. A positive edge triggered flip flop was the edge
circuit that generates pulses during rising edges.
n-bit Shift Register is connected serially. The flip flops
share the same reset and clock signals. The result is a counter
where only a single bit has a different value for two
consecutive counts. All the flip flops share the asynchronous
signal ‘reset’, which sets the initial count. n-BIT Register is a
collection of ‘n’ D-type flip flops, where each flip flop
independently stores one bit. The flip flops are connected in
parallel. They also share the same reset and clock signals.
D. Binary to BCD translation
There is 27 bits width required by register A and 29 bits
for register B. Since the maximum value of the input in this
calculator design is 99999999, the binary result has a bit
width of 27 bits to be translated into BCD form. The data
must be translated into the BCD format to be displayed on the
seven segments LED. There are eight LEDs to display the
computed result and another one to represent the result's sign.
E. Digit count
It is important to arrange the position of the digit count in
the calculator. The function of “*10” and “+” shifts the output
at the 7-segment LED display. Each time data input to the
system, the output at the display will move from the very right
side to the left side.
F. FSM for the calculator
Figure 3 illustrates the finite state machine of a calculator.
The finite state machine (FSM) summarizes the various
circumstances of feedback from the anticipated statistics to
the operation scheme. ‘DECIMAL’ is the initial state, which
is the alpha of the measure. The 10 keys assignment compute
as input from this standpoint. Just as count<=count+1,
thereupon REGA<=REGA*10+d. When the function ‘ce’
that erases the last figure or operation registered, it is inserted
at instant REGA <=0 as count <=0. When the mathematical
operations are registered, the state will shift. ‘OPE’ is the
following state. The out func =~ b+1 at ' OPE ' is (b[28]==1),
otherwise it is out func = b. Then the system moves to the
following state, which is ‘HALT’, where REGA<=0,
REGB<=0, operator<=0, and count < = 0, the overflow
occurs. This is the custom where you need to insert the ‘ac’
button. The ‘ac’ is responsible for clarifying the calculator
and changing functions. Once again, the program will return
to the ‘DECIMAL’ state.
Fig. 3. FSM of a calculator
IV. RESULT AND DISCUSSION
Figure 4 shows the RTL viewer of top-level module
design based on the code in the appendix. The top-level
module was named with ‘calctop’. The overall modules,
‘calc’, ‘syncro’, ‘syncro10’, ‘bintobcd’, ‘binled’, and ‘ledout’
were included in the top-level module. There are 14 inputs
pin and 15 outputs pin name in the design. Next, 11 syncro
blocks and 1 syncro10 block. Syncro depends on the user
which function will they be using, the data will enter the
‘calc’ module. In contrast, syncro 10 depends on the number
that the user has key in. All the data will enter the ‘calc’
module. Afterward, calculation main module ‘calc’, where all
the calculation of addition, subtraction, multiplication,
divide, exponential power of 2 and 3, factorial and square root
formula was processed. This module also includes the
process of the register bit width and the overflow of output.
Lastly, the ‘binled’ module which functions to transport the
information from the ‘calc’ module to the output which is
‘ledout’ to be displayed on seven segments LED, inside
‘binled’ module has a ‘bintobcd’ module and ‘ledout’
module.
Figure 5 shows the waveform summary in the
Report Timing report. The circuit implemented was on
the Cyclone V family device. Cyclone V has the highest
number of total registers. The size of registers indicates
the data that the system can be used at any given time.
In this circuit, the timing requirement is specified to
20.0ns clock. The amount of time for data to be present
at an input pin until the clock signal clocks at the
register is asserted at the clock pin, which feeds a
register through its data or activates inputs. The setup
slack value in this circuit is 12.711ns, which is positive
means it meets the time requirement. The clock delay is
4.985ns, represents the time between the launch at the
pin of the device and the clock inputs of the
Authorized licensed use limited to: UNIVERSITY MALAYSIA SARAWAK. Downloaded on January 06,2021 at 08:07:23 UTC from IEEE Xplore. Restrictions apply.
5. source/destination flip-flops. The required data showed
the time the data would have arrived at the flip-flop
destination by data delay takes by 5.758ns for a signal
to propagate from source to destination. The diagram
shows that the data arrives at its destination before the
time required to arrive. Therefore, the timing constraint
is satisfied.
Fig. 4. RTL view for top-level module ‘calctop’
Fig. 5. Waveform summary in Report Timing
Figure 6 shows an example of the waveform
simulation involving addition. The clock was inserted
as 20ns per period. The ‘equal’ waveform was always
put in a high position. According to the proper state, the
‘reset’ waveform was placed in a d flip-flop type to
handle the calculator design flow. Desired values are
inserted into the calculator’s design by pressing the
values in their binary form into the decimal waveform.
Desired selected operations can be selected by putting
their waveform high.
The binary input data is loaded into this function to
register A. Register A function returns the number of
users in the memory. Register A takes the first input
number. After that, the second input number begins
again from 0. Once the user chooses the desired
operation, the second input values can enter Register A.
The final values enter Register B. It transmits the
computed data in register B. Register B stored the input
number memory for processing purposes on the output.
Suppose the user selects the operation, such as the
addition. In that case, the multiplexer switches from 0
to 1, as it implies in a high or active state. Other
operations are subtraction, multiply, divide, square,
cube, square root, and factorial.
Based on Figure 6, two inputs from the ‘decimal’
signal loaded to register A are 96345 and 7812. The
operator selector is ‘add,’ which represented the
addition operation. The computed result is stored at
register B, 104157, and output at the ‘out’ waveform.
This means that when the number 96245 is added with
7812, the output is 104157. All the other operations
have the same method to get the final output.
Fig. 6. Waveform simulation of the ‘add’ function.
Figure 7, 8, 9, 10, 11, 12, and 13 show the waveform
simulation results of different function of calculator design
using Verilog HDL in this paper such a subtraction,
multiplication, division square, cube, square root and
factorial respectively.
Fig. 7. Waveform simulation of the ‘sub’ function
Fig. 8. Waveform simulation of the ‘mul’ function
96345 7812
104157
Authorized licensed use limited to: UNIVERSITY MALAYSIA SARAWAK. Downloaded on January 06,2021 at 08:07:23 UTC from IEEE Xplore. Restrictions apply.
6. Fig. 9. Waveform simulation of the ‘div’ function
Fig. 10. Waveform simulation of the ‘sq’ function
Fig. 11. Waveform simulation of the ‘cube’ function
Fig. 12. Waveform simulation of the ‘sqrt’ function
Fig. 13. Waveform simulation of the ‘factr’ function
V. CONCLUSION
The objective of this paper is to design eight digits of
calculator and implement operators using Verilog HDL, were
achieved. The calculator was designed, coded in Verilog
HDL, and simulated using Altera Quartus II. For designers,
Verilog HDL is important to create schematic chip systems
that can be implemented into Field Programmable Gate Array
(FPGA). Verilog HDL could describe and define the arbitrary
collection of digital circuits by performing operations in
parallel ways that are beneficial in comparison with other
languages. Cyclone V is the device chosen from the Altera
family device. Due to certain factors such as lack of facilities
and software, the calculator design has many deficiencies in
designing complex digital circuits using Verilog HDL. The
calculator designs can only generate an integer answer and
produce 8-digit output, which means that if the answer
includes decimal numbers, the result lack precision. It is
suggested for future work to get a more precise result;
floating-point includes getting an accurate output. Lastly, it
is recommended to include more mathematical operations to
solve complex mathematical problems, such as logarithmic,
exponential, and trigonometric functions.
ACKNOWLEDGMENT
The author would like to thank Universiti Malaysia
Sarawak (UNIMAS) for providing opportunity and facilities
to support this project.
REFERENCES
[1] “What is calculator? definition and meaning.” [Online]. Available:
http://www.businessdictionary.com/definition/calculator.html.
[Accessed: 20-Nov-2019].
[2] “Evolution of the calculator.” [Online]. Available:
https://cosmosmagazine.com/mathematics/evolution-calculator.
[Accessed: 25-Nov-2019].
[3] “SchoolMart.” [Online]. Avalable:
https://www.schoolmart.com/2017/03/29/the-calculator-a-brief-
history/?v=e71bc9c013d9. [Accessed: 20-Nov-2019].
[4] “The People's Best Friend: The Calculators' Brief History.” [Online].
Available: https://interestingengineering.com/brief-history-
calculators. [Accessed: 20-Nov-2019].
[5] “Casio.” [Online]. Available:
http://www.vintagecalculators.com/html/casio.html. [Accessed: 20-
Nov-2019].
[6] “The History of the Calculator.” [Online]. Available:
https://www.thecalculatorsite.com/articles/units/history-of-the-
calculator.php. [Accessed: 20-Nov-2019].
[7] “Digital Logic Gate Tutorial - Basic Logic Gates.” [Online]. Available:
https://www.electronics-tutorials.ws/logic/logic_1.html. [Accessed:
20-Nov-2019].
[8] “How Does a Calculator Work?” [Online]. Available:
https://www.wonderopolis.org/wonder/how-does-a-calculator-work.
[Accessed: 20-Nov-2019].
[9] “Learnabout electronics.” [Online]. Available: http://www.learnabout-
electronics.org/Digital/dig21.php. [Accessed: 20-Nov-2019].
[10] K.Coffman, Real world FPGA design with Verilog. Upper Saddle
River, NJ: Prentice Hall PTR, 2000.
[11] “Register Transfer Level.” [Online]. Available:
https://semiengineering.com/knowledge_centers/eda-
design/definitions/register-transfer-level/. [Accessed: 25-June-2020].
[12] Huang, J. L., & F.Cauley, S. (2009). Chapter 8. In C. K. Koh (Ed.),
Logic and circuit simulation (pp. 449-512).
[13] Hamblen, J. O., & Furman, M. D. (2002). Chapter 3. In Rapid
Prototyping of Digital Systems: A Tutorial Approach (pp. 37-52).
Boston, MA: Springer US.
[14] Mathew, B., Stopyak, M., Wagner, M. (2017) Simple Calculator ECE
2700-Digital Logic Design Final Project Paper. (2017). Simple
Calculator ECE 2700-Digital Logic Design Final Project Paper.
[15] Shelke, M. G., Jaunjare, N. V., & Penshanwar, S. K. (2017).
Calculator design with RISC (64 bit) architecture using VERILOG and
FPGA. Calculator Design with RISC (64 Bit) Architecture Using
VERILOG and FPGA.
[16] Yusmardiah, Y, Darmawaty, M., A, Abdul Karimi, H, Abdul Aziz, A.,
R, & Ahmad, K., S. (2017). Translation of division algorithm into
verilog hdl. translation of division algorithm into verilog HDL.
[17] Banerjee, A., & Das, D. K. (2016). A new ALU architecture design
using reversible logic. 2016 Sixth International Symposium on
Embedded Computing and System Design (ISED). doi:
10.1109/ised.2016.7977079
Authorized licensed use limited to: UNIVERSITY MALAYSIA SARAWAK. Downloaded on January 06,2021 at 08:07:23 UTC from IEEE Xplore. Restrictions apply.
7. [18] L., I. E., Q., E. R., Colinares, D. S., Lousie, J. D., & Caldo, R. B. (n.d.).
12-bit Verilog calculator with trigonometric functions. 12-bit verilog
calculator with trigonometric functions, 3(No.), 43–48.
[19] Jin, G. S. (n.d.). Simple 8-Bit Calculator Design Bit Slicing Technique
And FPGA Prototyping.
[20] Sutikno, T., Jidin, A. Z., Jidin, A., & Idris, N. R. (2012).
Simplified VHDL Coding of Modified Non-Restoring Square Root
Calculator. International Journal of Reconfigurable and Embedded
Systems (IJRES), 1(1). doi:10.11591/ijres.v1i1.440
[21] Wang, X., Zhang, Y., Ye, Q., & Yang, S. (2009). A New Algorithm for
Designing Square Root Calculators Based on FPGA with Pipeline
Technology. 2009 Ninth International Conference on Hybrid
Intelligent Systems. doi: 10.1109/his.2009.27
[22] C. Yu, “Verilog Hardware Description Language,” 26-Feb-2007.
[Online]. Available:
http://ece.niu.edu.tw/~chu/download/fpga/verilog.pdf. [Accessed: 7-
Dec-2019]
Authorized licensed use limited to: UNIVERSITY MALAYSIA SARAWAK. Downloaded on January 06,2021 at 08:07:23 UTC from IEEE Xplore. Restrictions apply.
View publication stats
View publication stats