Thermo Metric To Binary Code Converter
Thermo Metric To Binary Code Converter
����������������������������������������������������������������������������������������������������������������������������
�
MIXED DESIGN
��
�bstract—This paper compares several approaches to come mometer code) is large and the complexity of thermometer-
up with the Verilog HDL model of the thermometer-to-binary to-binary encoder grows rapidly. So, in the real-life cases it is
encoder with bubble error correction. It has been demonstrated practically impossible to try out competitive implementations.
that implementations of different ideas to correct bubble errors
yield circuits whose parameters tremendously vary in delay, II. T HE G OAL
area and power consumption. The shortest delay is achieved for
the design synthesized from the model which mimics a human The goal of this work was to investigate which thermometer-
reading temperature on classic liquid-in-glass thermometer. to-binary encoder implementation, encoded as a Verilog HDL
model, yields fastest solution and is resistant to 2nd order
Index Terms—thermometer-to-binary encoder, bubble error bubble error (which is a cluster of two sebsequent ’0’).
correction, FLASH ADC, HDL model, logic synthesis. Several experiments have been carried out to compare cost
of implementation (layout area and power consumption) of
I. I NTRODUCTION different solutions.
Nowadays, the use of automatic logic synthesis of Verilog A. Assumptions
or VHDL model to generate a digital circuit is the preferred
All the implementations discussed in this paper have been
design style, especially when complex algorithms are imple-
developed under the following assumptions concerning the
mented [1]–[6]. The obvious advantages, among the others,
input thermometer code:
are ease of targeting different technologies and simplicity to
• all the bits set to ’1’ are correct,
make changes to constraints in order to obtain fast or low-
• all the bits set to ’0’ above top ’1’ are correct,
power circuit.
• all the bits set to ’0’ below top ’1’ are incorrect.
Modern commercial CAD software are powerful tools
boasting 100+ million gate strength. However, the design It should be noted that the bubble error that modifies the top
performance resulting from HDL code synthesis is highly most ’1’ cannot be detected since there is no way to distinguish
sensitive to modeling style. The Verilog or VHDL statements it from valid ’0’. None of the existing solution [19]–[24] can
and model structures, which appear to an average engineer correct this specific location of BER.
absolutely equivalent, are often processed by the logic synthe- B. Encoder Structure
sis tools in completely different way. As a consequence, the Typical solution to improve performance of a design, either
same CAD tool may infer a completely unalike logic imple- in case of software or hardware, is the divide and conquer
mentation for the exactly the same algorithm but differently approach. In the case of the encoder, a simple decomposition
encoded. technique has been employed [18]. Whenever it made a sense,
A thermometer-to-binary encoder is a standard component the encoder was divided into several segments that indepen-
of flash ADC [7]–[18]. One of the common design problem to dently process a sub-ranges of the input vector. Each segment
be solved there is how to make the circuit resistant to bubble produces a sub-code which are subsequently aggregated to
error [19]–[24]. The bubble error (BER) is defined as a missing produce the final output binary code. The modified encoder
’1’ in input thermometer code. The BER may be a result of structure is shown in the Fig.1.
e.g. switching noise spreading through the comparators of the
FLASH ADC. Whatever is the reason of a BER it results in �
� �� �
� ��
erroneous output binary code. ��������
�����������
The typical approach to encoder implementation is to use � ������������ �
������� ��
a ROM or devise a combinatorial circuit whose structure is ���������
derived directly from Boolean expression [7]–[17], [19]–[24]. � ��������
However, these approaches do not exhibit the flexibility pro- � �����������
vided by automatic logic synthesis. This disadvantage is par-
ticularly burdensome in cases of higher ADC resolutions when Fig. 1. The idea of encoder decomposition.
number of comparators (and thus the number of bits in ther-
���� ����������������� ��������� � ���� �� ���������� �� ���������������� � �������� �������� ���� ���������� �� ���������� ���
C. Bubble Error Correction The results are shown in Table I. As can be observed, the
The two classic bubble error correction (BEC) approaches fastest and smallest implementation (but most power-hungry)
have been employed. The first one utilizes OR gates to form is obtained for the simplest solution.
logical sum of three neighboring bits: LISTING I
M ODEL OF ”T HE HIGHEST ’1’” DECOMPOSED INTO 2 SEGMENTS .
module t h e r m o 2 b i n ( thermo , b i n ) ;
bcorr [i] = b[i] ∨ b[i � 1] ∨ b[i � 2] (1) input [ 6 2 : 0 ] thermo ;
output [ 5 : 0 ] bin ;
where n = 0 � � � 2n − 3
reg [ 5 : 0 ] bin , bin1 , bin2 ;
The second method utilizes a modified one-hot encoder. It integer i , j ;
takes 3-input AND gate to convert thermometer code into one-
a l w a y s @( t h e r m o )
hot code: begin
bin1 = 0;
bcorr [i] = b[i] ∧ �b[i � 1] ∧ �b[i � 2] (2) f o r ( i = 1 ; i �=32; i = i + 1 )
i f ( t h e r m o [ i −1] == 1 ’ b1 ) b i n 1 = i ;
where n = 0 � � � 2n − 3. end
���
LISTING II LISTING III
”T HE H IGHEST ’1’ WITH BEC” DECOMPOSED INTO 2 SEGMENTS . O NE - HOT ENCODING
a l w a y s @( t h e r m o b ) a l w a y s @( t h e r m o b )
begin begin
f o r ( k = 0 ; k �=60; k=k + 1 ) f o r ( k = 0 ; k �=60; k=k + 1 )
t h e r m o [ k ] �= t h e r m o b [ k ] | | t h e r m o b [ k + 1 ] | | t h e r m o b [ k + 2 ] ; t h e r m o [ k ] �= t h e r m o b [ k ] �� ˜ t h e r m o b [ k + 1 ] �� ˜ t h e r m o b [ k + 2 ] ;
t h e r m o [ 6 1 ] �= t h e r m o b [ 6 1 ] | | t h e r m o b [ 6 2 ] ; t h e r m o [ 6 1 ] �= t h e r m o b [ 6 1 ] �� ˜ t h e r m o b [ 6 2 ] ;
t h e r m o [ 6 2 ] �= t h e r m o b [ 6 2 ] ; t h e r m o [ 6 2 ] �= t h e r m o b [ 6 2 ] ;
end end
a l w a y s @( t h e r m o ) a l w a y s @( t h e r m o )
begin begin
bin1 = 0; bin1 = 0;
f o r ( i = 1 ; i �=32; i = i + 1 ) f o r ( i = 1 ; i �=32; i = i + 1 )
i f ( t h e r m o [ i −1] == 1 ’ b1 ) b i n 1 = i ; i f ( t h e r m o [ i −1] == 1 ’ b1 ) b i n 1 = i ;
end end
a l w a y s @( t h e r m o ) a l w a y s @( t h e r m o )
begin begin
bin2 = 0; bin2 = 0;
f o r ( j = 1 ; j �=31; j = j + 1 ) f o r ( j = 1 ; j �=31; j = j + 1 )
i f ( t h e r m o [ j + 3 1 ] == 1 ’ b1 ) b i n 2 = j ; i f ( t h e r m o [ j +3 1 ] == 1 ’ b1 ) b i n 2 = j ;
end end
a l w a y s @( b i n 1 or b i n 2 ) a l w a y s @( b i n 1 or b i n 2 )
i f ( t h e r m o [ 3 1 ] == 1 ’ b1 ) i f ( bin2 > 0)
bin = bin2 + 32; bin = bin2 + 32;
else else
bin = bin1 ; bin = bin1 ;
endmodule endmodule
� of segments delay � of sdt. cells sdt. cell area power � of segments delay � of sdt. cells sdt. cell area power
[ps] [µm� � [µ� � [ps] [µm� � [µ� �
1 345 208 1093 1519 1 287 295 1651 2916
2 276 348 2022 4165 2 304 284 1426 2391
4 296 220 1211 2292 4 410 257 1319 1808
8 307 251 1412 2616 8 455 274 1470 1694
16 455 244 1153 1145 16 490 281 1445 1199
���
LISTING IV LISTING V
S UM OF BITS WITH OR M ODEL VERSION C: D IRECT TRUTH TABLE IMPLEMENTATION
a l w a y s @( t h e r m o b ) a l w a y s @( t h e r m o b )
begin begin
f o r ( k = 0 ; k �=60; k=k + 1 ) f o r ( k = 0 ; k �=60; k=k + 1 )
t h e r m o [ k ] �= t h e r m o b [ k ] | | t h e r m o b [ k + 1 ] | | t h e r m o b [ k + 2 ] ; t h e r m o [ k ] �= t h e r m o b [ k ] | | t h e r m o b [ k + 1] | | t h e r m o b [ k + 2 ] ;
t h e r m o [ 6 1 ] �= t h e r m o b [ 6 1 ] | | t h e r m o b [ 6 2 ] ; t h e r m o [ 6 1 ] �= t h e r m o b [ 6 1 ] | | t h e r m o b [ 6 2 ] ;
t h e r m o [ 6 2 ] �= t h e r m o b [ 6 2 ] ; t h e r m o [ 6 2 ] �= t h e r m o b [ 6 2 ] ;
end end
a l w a y s @( t h e r m o ) a l w a y s @( t h e r m o )
begin casez ( thermo )
bin1 = 0; 63 ’ h0000000000000000 : bin = 0;
f o r ( i = 0 ; i �=31; i = i + 1 ) 63 ’ h0000000000000001 : bin = 1;
bin1 = bin1 + thermo [ i ] ; 63 ’ h0000000000000003 : bin = 2;
end ..................... .. .... .....
..................... .. .... .....
a l w a y s @( t h e r m o ) ..................... .. .... .....
begin 63 ’ h 1 f f f f f f f f f f f f f f f : bin = 61;
bin2 = 0; 63 ’ h 3 f f f f f f f f f f f f f f f : bin = 62;
f o r ( j = 3 2 ; j �=62; j = j + 1 ) 63 ’ h 7 f f f f f f f f f f f f f f f : bin = 63;
bin2 = bin2 + thermo [ j ] ; / / To avoid D-latches default bin value has to be set.
end / / Possible options are: 6’b000000, 6’b111111, 6’bzzzzzz
default : bin = 6 ’ b000000 ;
a l w a y s @( b i n 1 or b i n 2 ) endcase
i f ( bin2 > 0)
bin = bin2 + 32; endmodule
else
bin = bin1 ;
LISTING VI
endmodule M ODEL VERSION D: PRIORITY ENCODER
module t h e r m o 2 b i n ( thermob , b i n ) ;
input [ 6 2 : 0 ] thermob ;
TABLE IV output [ 5 : 0 ] bin ;
R ESULTS OF SYNTHESIS OF ”S UM OF BITS WITH OR”
integer k ;
reg [ 6 2 : 0 ] thermo ;
� of segments delay � of sdt. cells sdt. cell area power
reg [ 5 : 0 ] bin ;
[ps] [µm� � [µ� �
1 1010 1104 6821 4953 a l w a y s @( t h e r m o b )
2 910 1128 6624 4827 begin
4 650 926 5578 5474 f o r ( k = 0 ; k �=60; k=k + 1 )
t h e r m o [ k ] �= t h e r m o b [ k ] | | t h e r m o b [ k + 1] | | t h e r m o b [ k + 2 ] ;
8 470 621 3668 4575
16 325 341 1674 2987 t h e r m o [ 6 1 ] �= t h e r m o b [ 6 1 ] | | t h e r m o b [ 6 2 ] ;
t h e r m o [ 6 2 ] �= t h e r m o b [ 6 2 ] ;
end
���
TABLE V particular standard cells from a specific target library. Thus,
R ESULTS OF SYNTHESIS OF TRUTH TABLE IMPLEMENTATION in case of other technologies (or different technology modules
default case delay � of sdt. cells sdt. cell area power e.g. high performance, low-leakage, etc.) it may turn out that
[ps] [µm� � [µ� � shortest delay is achieved for a different model variant than
bin = 6’b000000 401 703 4218 5767 reported in this paper. Analogous effects might be expected
bin = 6’b111111 375 704 4339 6320 when different synthesis tool is used.
bin = 6’bzzzzzz 644 509 2557 2157
IX. C ONCLUSIONS
TABLE VI
R ESULTS OF SYNTHESIS OF PRIORITY ENCODER
As has been demonstrated in this paper, in real-life projects,
when the number of comparators in the FLASH ADC is large,
delay � of sdt. cells sdt. cell area power finding an optimal implementation of thermometer-to-binary
[ps] [µm� � [µ� �
encoder is not so easy.
360 309 1417 2222
A routine task like converting thermometer code into binary
word seems to be a relatively easy to realize. However, with
VIII. S UMMARY OF R ESULTS larger number of the input bits complexity of the resulting
logic grows rapidly, both in therms of the number of used logic
The five different approaches to implement thermometer- gates as well as the length of interconnections. The critical
to-binary encoder with be bubble error correction have been path, layout area and power consumption depends heavily
examined. Whenever it made a sense, a simple decomposition on the actual logic structure and parasitics introduced be the
technique (divide and conquer approach) has been employed. wiring.
All the Verilog models have been synthesized with a com- Evidently, full-custom approach to such a task is burden-
mercial CAD tool. An industrial 65 nm CMOS process has some and automatic logic synthesis seems to be a sensible al-
been used as the target technology. The synthesis procedure ternative. However, there are pitfalls here, too. Various VHDL
has been carried out in such a way that allowed to obtain the or Verilog HDL statements and/or model structures may result
fastest possible circuit for every variant. in completely different parameters of the synthesized circuits.
The Table VII presents parameters of the three best designs: The fact an average engineer is usually not aware of.
”the highest ’1’”, ”the highest ’1’ with BEC” and ”one-hot
In order to get the most from automatic logic synthesis
encoding”.
designers have to understand how CAD tools infer logic. It
should be clear that even most powerful software cannot im-
TABLE VII
R ESULTS OF SYNTHESIS : THE FASTEST MODEL VARIANTS
prove poor algorithms and/or poor encoding. It is the engineer
role to come up with clever ideas and specify it in such way
model variant parts delay cells cell area power that CAD tools can generate optimal implementation.
[ps] [µm� � [µ� �
highest ’1’ (native) 1 290 267 1467 2406 R EFERENCES
highest ’1’ w/ BEC 2 276 348 2022 4165
one-hot encoding 1 287 295 1651 2916 [1] M. Muzal and Z. Jaworski, “Hardware implementation of fuzzy logic
based diagnostic algorithm for implantable cardioverter defibrillator,”
in Proceedings of the 11th International Conference Mixed Design
All of these circuits were synthesized from the Verilog mod- of Integrated Circuits and Systems MIXDES’2004. Wydawnictwo
els which implement algorithms that mimics human reading Politechniki dzkiej, 2004, pp. 579–584.
temperature on classic liquid-in-glass thermometer yield. In [2] A. Bardossy, A. Blinowska, W. Kumicz, J. Ollitrault, M. Lewandowski,
A. Przybylski, and Z. Jaworski, “Fuzzy logic-based diagnostic algorithm
all these cases the length of the critical path is relatively for implantable cardioverter defibrillators,” Artificial Intelligence in
similar and belongs to the range of 276. . . 290 ps. Much more Medicine, no. 60, pp. 113–121, 2014.
significant are differences in power consumption and layout [3] A. Wojtasik, Z. Jaworski, W. Kumicz, A. Wielgus, A. Wakanis, and
D. Sarna, “Fuzzy logic controller for rate-adaptive heart pacemaker,”
area. Applied Soft Computing, vol. 4, pp. 259–270, 2004.
The first solution has a unique feature – it is resistant to [4] M. Banaszkiewicz, S. Gadomski, A. Gaat, and Z. Jaworski, “The
all kinds of bubble errors. It utilizes the simplest idea and rosettabis asic for the rosetta space mission,” in Proceedings of the
7th International Conference: Mixed Design of Integrated Circuits and
does not use any special BEC circuitry. In addition, the cost Systems MIXDES 2000, A. Napieralski, Ed. Technical University of d,
of implementation is the lowest. 2000, pp. 587–590.
The two other approaches exhibit slightly shorter critical [5] Z. Jaworski, W. Kumicz, M. Sadowski, D. Sarna, A. Wakanis, A. Wiel-
gus, and A. Wojtasik, “Vlsi implementations of fuzzy logic controllers
paths but need more silicon area and consume more energy. for rate-adaptive pacemakers,” in Microtechnologies in Medicine and
What’s most important, they are resistant to 2nd order bubble Biology, 1st Annual International, Conference On. 2000, 2000, pp.
error at most. 475–478.
[6] A. Bardossy, A. Blinowska, Z. Jaworski, W. Kumicz, J. Ollitrault,
So, there is a dilemma. Should the fastest solution be chosen A. Penciolelli, D. Sarna, A. Wakanis, A. Wielgus, and A. Wojtasik,
or maybe the one most resistant to the bubble errors? The “Application of fuzzy logic to pacemaker control,” Biocybernetics and
answer depends on the priorities in a particular project. Biomedical Engineering, vol. 1, pp. 7–23, 2003.
[7] E. Sail and M. Vesterbacka, “Comparison of two thermometer-to-binary
It should also be emphasized that parameters of the syn- decoders for high-performance flash adcs,” in NORCHIP Conference,
thesized circuits considerably dependent on the features of 2005. 23rd, Nov 2005, pp. 253–256.
���
[8] S. Ali, R. Raut, and M. Sawan, “Digital encoders for high speed flash-
adcs: Modeling and comparison,” in Circuits and Systems, 2006 IEEE
North-East Workshop on, June 2006, pp. 69–72.
[9] E. Sail and M. Vesterbacka, “Thermometer-to-binary decoders for flash
analog-to-digital converters,” in Circuit Theory and Design, 2007. EC-
CTD 2007. 18th European Conference on, Aug 2007, pp. 240–243.
[10] G. Madhumati, K. Rao, and M. Madhavilatha, “Comparison of 5-bit
thermometer-to-binary decoders in 1.8v, 0.18 um cmos technology for
flash adcs,” in 2009 International Conference on Signal Processing
Systems, May 2009, pp. 516–520.
[11] P. Kanodiya and A. Naik, “Analysis and design of flash analog to digital
converter for ultra wide band application,” in Engineering �NUiCONE),
2011 Nirma University International Conference on, Dec 2011, pp. 1–5.
[12] A. Kale, P. Palsodkar, and P. Dakhole, “Comparative analysis of 6 bit
thermometer-to-binary decoders for flash analog-to-digital converter,”
in Communication Systems and Network Technologies �CSNT), 2012
International Conference on, May 2012, pp. 543–546.
[13] X. Hu, L. Zhao, S. Liu, J. Wang, and Q. An, “A stepped-up tree encoder
for the 10-ps wave union tdc,” in Real Time Conference �RT), 2012 18th
IEEE-NPSS, June 2012, pp. 1–5.
[14] P. Palsodkar, P. Dakhole, P. Palsodkar, and A. Kale, “Highly digitalized
flash analog to digital (fadc) converter using mux based decoder topol-
ogy,” in Emerging Technology Trends in Electronics, Communication
and Networking �ET2ECN), 2012 1st International Conference on, Dec
2012, pp. 1–6.
[15] A. Chunn and R. Sarin, “Comparison of thermometer to binary encoders
for flash adcs,” in India Conference �INDICON), 2013 Annual IEEE, Dec
2013, pp. 1–4.
[16] M. Pasha and M. Vesterbacka, “A modified switching scheme for
multiplexer based thermometer-to-binary encoders,” in NORCHIP, 2014,
Oct 2014, pp. 1–4.
[17] C. Vudadha, G. Makkena, M. Nayudu, P. Phaneendra, S. Ahmed,
S. Veeramachaneni, N. Muthukrishnan, and M. Srinivas, “Low-power
self reconfigurable multiplexer based decoder for adaptive resolution
flash adcs,” in VLSI Design �VLSID), 2012 25th International Confer-
ence on, Jan 2012, pp. 280–285.
[18] Z. Jaworski, “Choosing the optimal hdl model of thermometer-to-binary
encoder,” in Mixed Design of Integrated Circuits Systems �MIXDES),
2015 22nd International Conference, June 2015, pp. 297–300.
[19] Y.-J. Chuang, H.-H. Ou, and B.-D. Liu, “A novel bubble tolerant
thermometer-to-binary encoder for flash a/d converter,” in VLSI Design,
Automation and Test, 2005. �VLSI-TSA-DAT). 2005 IEEE VLSI-TSA
International Symposium on, April 2005, pp. 315–318.
[20] N. Agrawal and R. Paily, “An improved rom architecture for bubble error
suppression in high speed flash adcs,” in Student Paper, 2008 Annual
IEEE Conference, Feb 2008, pp. 1–5.
[21] M. Rahman, K. Baishnab, and F. Talukdar, “A novel rom architecture for
reducing bubble and metastability errors in high speed flash adcs,” in
Electronics, Communications and Computer �CONIELECOMP), 2010
20th International Conference on, Feb 2010, pp. 15–19.
[22] B. V. Hieu, S. Beak, S. Choi, J. Seon, and T. Jeong, “Thermometer-to-
binary encoder with bubble error correction (bec) circuit for flash analog-
to-digital converter (fadc),” in Communications and Electronics �ICCE),
2010 Third International Conference on, Aug 2010, pp. 102–106.
[23] B. V. Hieu, S. Choi, J. Seon, Y. Oh, C. Park, J. Park, H. Kim, and
T. Jeong, “A new approach to thermometer-to-binary encoder of flash
adcs- bubble error detection circuit,” in Circuits and Systems �MWSCAS),
2011 IEEE 54th International Midwest Symposium on, Aug 2011, pp.
1–4.
[24] S. Kumar, M. Suman, and K. Baishnab, “A novel approach to
thermometer-to-binary encoder of flash adcs-bubble error correction cir-
cuit,” in Devices, Circuits and Systems �ICDCS), 2014 2nd International
Conference on, March 2014, pp. 1–6.
���