Paper of Rules of RTL Conversion On RISC - Ver2
Paper of Rules of RTL Conversion On RISC - Ver2
Design
Demyana Emil
Teaching Assistant, Electrical Department, Faculty of Engineering, Fayoum University, Egypt
Email: [email protected]
Mohammed Hamdy
Assistant professor, Electrical Department, Faculty of Engineering, Fayoum University, Egypt
Email: [email protected]
Gihan Nagib
Associate professor, Electrical Department, Faculty of Engineering, Fayoum University, Egypt
Email: [email protected]
Abstract: Hardware design is an important process in computer architecture, digital electronics and more fields
related to computer science. Register transfer level (RTL) synthesis, an important step in digital hardware design,
abstracts the model of an implemented design to a digital electronics circuit in registers form. This paper introduces
some rules on an implemented design to make it satisfy with the RTL level rules. These rules ease the conversion of
this design to RTL circuit. This process is occurring after simulation level directly. Hence, the paper discusses some
common issues that some hardware designers may make on simulation level that prevent their design to work on RTL
successfully. The work introduces solutions for these issues, in addition to some common simulation errors that can
be avoided. If the rules of RTL have been followed in simulation level (initial step), it reduces more time exerted on
modification on design after the simulation level for making the design available to work on RTL. It is also rare to
find such this topic explained clearly and separately, however, it is so important. This work depends on an
implemented open processor. This processor is single-core and works under RISC-V instruction set.
2. RELATED WORK
This partition explains the historical work about
RTL rules of Verilog coding and how it is related with
real hardware circuits [7-8]. These cited rules are
estimated for Verilog HDL (Hardware Design
Language) and can be used for different digital
electronics systems like VLSI [9-10]. But for
SystemVerilog, the design requires additional rules
[11].
Multiple standard HDLs are available for
hardware structure design, to get the preferable one,
Pong makes a good comparison between
SystemVerilog and Verilog [12]. It has been shown
from the previous comparison that the SystemVerilog Figure 2 Block diagram of signal dependency
is prefered for more efficient verification. Like that has
been used in a peripheral device for management Table I shows different logic operations and the
process between two RvCores [13]. SystemVerilog is output signal that depends on set of valuable and don’t
used for more accurate synthesis for complex design care signals. If block3’s output depends on interface1
[14]. RTL has Multiple fields that can be implemented and interface2, the output still “don’t care” in some
like CNN (convolutional neural networks) [15], FINN cases like case1 and case4 in Table I.
matrix vector [16] and can be used in Matlab (math
works) [17]. TABLE I LOGIC OPERATIONS BETWEEN VALUABLE AND
RTL coding purpose is for FPGA [18]. The output DON’T CARE SIGNALS
RTL model is ready to work on the FPGA kits. Like
Interface Interface Logic Outpu
these designs, can be optimized for more 1 2 operatio t (y)
enhancement too [19]. n
Case X 1 OR 1
Additionally, to avoid getting error such as 1 1 X
multiple drivers and so on simulator, some rules are Case X 0 OR X
explained for this purpose [20]. RTL designers always 2 0 X
use the always procedures. Each hardware language Case X 1 AND X
has different forms of always procedures. Verilog 3 1 X
Case X 0 AND 0 y =1;
4 0 X Else
y =0;
To avoid the problem due to “don’t care” signals, TABLE IV ALGORITHM 2 OF DON’T CARE SIGNAL
there are two solutions that can be implemented. They SOLUTIONS
are shown in Table II.
Algorithm 2
TABLE II DON’T CARE SIGNALS’ SOLUTIONS
If (interface1 & interface2)
Case Solution 1 Solution 2 y =1;
Case2 (in Algorithm 1 Initialize Else
Table I) interface 1&2 y =0;
by zero (in
block 1 &2) The two solutions can be implemented according
Case3 (in Algorithm 2 Initialize to the design. Algorithm 1 and algorithm 2 have been
Table I) interface 2&1 implemented on a RISC-V processor [3]. Figure 3
(in block 2&1) shows the problem that has been result from “don’t
by zero care” signals coming as an input signal to a block in
the processor design.
To solve the above problem in hardware design,
Algorithm 1 and Algorithm 2 implement simple The waveforms in Figure 3 express set of data stored
temporary solutions. These solutions can be at a data structure acting as registers. The locations
implemented for signals that you don’t want to shown in the Figure 3 entitle that there are set of
initialize. locations have updated their contents with new data in
case the others haven’t. This is the problem, the input
TABLE III ALGORITHM OF DON’T CARE SIGNAL
SOLUTIONS
“don’t care” signals have affected this block not to
make it available to update some locations at its data
Algorithm 1 structure unit. Location 3 is an example for those
which have been affected by this problem.
If (interface1 | interface2)
Figure 3 The problem of don’t care affecting output signals of a block design
The big common error is to insert an assign From example_1; it is shown that the first rule is
statement in any type of the previous always not to insert any assign statement in always_ff
procedure. If the block has interface of set of signals procedure. Figure 5 shows the problem. Figure 6
(Ex: interface_1 shown in the below example (Table shows the waveform after Algorithm 4 is appended.
VI))
So, from the two previous figures (Figure 7,8), it is paper has shown that we can apply some RTL rules in
option for the designer to choose the best procedure simulation first, hence we can avoid recodification on
for his design according to the main behavior. In the our developed design. Some extensive tests have
two procedures, it has been found that if the condition applied on an open single RvCore and we have applied
is true, the copying process is done successfully. our developed algorithms and showed our results of
Otherwise, (take into consideration Algorithm 4) these algorithms on the waveforms of arbitrary blocks
interface_1 is updated by zero even signal_1 hasn’t of the processor. We have shown the performance of
been changed to zero. Take into your consideration these blocks before and after applying the algorithms.
that this copying process doesn’t occur continuously These algorithms have corrected more bugs in this
nor automatically. It occurs only in case of true processor design. The paper also has discussed some
condition otherwise interface_1 doesn’t keep its value special simulation errors on design and how they have
taken from signal_1 at a time while true condition. been corrected by multiple methods. It has shown
multiple solutions according to the designer target. It
• Rule_5: if you need to define a memory has been shown that RTL synthesis process has
block, it should be finite in size. different rules from simulation rules. Some rules,
• Rule_6: when the memory is loaded by a result from extensive testing, have been presented and
program, it should start being loaded the explained in details. SystemVerilog hardware
initial address of the memory. Also, it should language has been used to implement the previous
be loaded by a binary program file only. algorithms. Vivado tool is the main tool that has been
used.
In the future, we will invest more time in
improving the design performance according to what
5. CONCLUSION AND FUTURE have been addressed in RTL rules. Additionally, how
WORK to implement a main memory based on RTL rules and
The paper has shown the difference among set of reduce the total number of clock cycles consumed for
procedures and special statements in simulation. it. How to build a simulation memory. How to make
Additionally, simulation level is a base level in digital the design work on the FPGA or Zedboard kits. Hence,
hardware design to check the working design we can compare our result with standard results. We
correctly. The RTL process is a second important level will use standard benchmarks to test and verify the
in hardware design following the simulation level. The total design.
Implementation of FINN Matrix Vector Compute Unit”,
arXiv:2201.11409v2
[6] Vivado Design Suite User Guide, [22] Stuart Sutherland Simon Davidmann Peter Flake,
http://www.xilinx.com/warranty.htm “SystemVerilog For Design Second Edition”. Springer
Science+Business Media, LLC
[7] S. Gayathri and T. C. Taranath, (2017), "RTL synthesis of case
study using design compiler" International Conference on [23] “Programmable Logic/Verilog RTL Coding Guidelines”,
Electrical, Electronics, Communication, Computer, and retreived date: [2017], online at:
Optimization Techniques (ICEECCOT), pp. 1-7, doi: https://en.wikibooks.org/wiki/Programmable_Logic/Verilog_
10.1109/ICEECCOT.2017.8284603. RTL_Coding_Guidelines
[8] Taraate, V. (2019), “RTL Design Guidelines”, In: Advanced [24] Michael Keating and Pierre Bricaud, (2001), “RTL Coding
HDL Synthesis and SOC Prototyping. Springer, Singapore. Guidelines”, National Chiao Tung University, pp. 12-32
https://doi.org/10.1007/978-981-10-8776-9_3
[25] Adam Drozdek, “Data Structures and Algorithms in C++”
[9] (2007), “RTL Coding Guidelines”, In: Digital VLSI Systems www.cengage.com/highered
Design. Springer, Dordrecht. https://doi.org/10.1007/978-1-
4020-5829-5_5 Authors Biography
[10] RTL DESIGN GUIDELINES, retreived date: [2022], online Demyana Emil, is teaching assistant at
available at:
Electrical Department, Electronics and
http://www.asic.co.in/DesignGuidlinesRTLcoding.htm
Communication Engineering major in
[11] “SystemVerilog RTL Tutorial”, retreived date: [2017], online Faculty of Engineering, Fayoum
at: University, Egypt. She has completed
https://www.doulos.com/knowhow/systemverilog/systemverilog- B.Sc. degree in Electronics and
tutorials/systemverilog-rtl-tutorial/ Communication Engineering specialized
in Embedded System at Fayoum
[12] Pong P. Chu, (May 2018), “SystemVerilog vs Verilog in RTL University. Her research interests are
Design”, pp. 1-4
computer architecture, synchronized
[13] Demyana Emil, Mohammed Hamdy, and Jihan Nagib, (2022), data, hardware design and software
“Dual-RvCore32IMA: Implementation of a Peripheral device development.
to Manage Operations of Two RvCores” 4 th International
Conference on Intelligen Computing, Information and Control
System, Springer, pp. 4-10