Vlsi Chap
Vlsi Chap
'1
• . . ff' . h . -- prov1ct
speed efficient solutions and 1s more e 1cient t an mference of . es area
. . PUOrity
usmg if-then-else statements. A- enc,
Fig. 4.6.5 shows the synthesized circuit of 4: 1 mux using B
case statement. For synthesize again the Xilinx XC4000 family Mux
C
is used as technology library. In tht:se examples, the case
implementation requires only one XC4000 CLB while the if D
implementation requires two CLBs (using the Synopsys FPGA
compiler). In this case, design the mux using the case statement SEL (1:0)
because fewer resources are used and delay path is shorter. Fig. 4.6.4 : Multiplex~r .
IISing
. · . · . case statement
The following examples mfer a 4 : 1 Multiplexer using a case statement.
library ieee;
use ieee.std_logic_1164.all;
.let o/r
o,10
entity MUX4_1 is
port( Sel : in std_logic;_vector(l downto 0); 0 O A
A, B, C, D : in std_logic; · 1?,·
Y : out std_logic );
end MUX4_1; C
'
f)
architecture behavior2 of MUX4 1 is
begin - l .
'
-- Most common and easies·t to read method
. ;.:. Multiplexer selection very clear using case statement
process (Sel, A, B, c, D)
begin ·
case Selis
when "00" => Y<=A·,
when "01" ;:::> Y<=B·
wh~n "10" => Y<=C;
when "11" => Y<=D·
when others => y<~A.
end case; '
end process;
end behavior2;
• /4rtttt' rims 11±1
II VLSI Design & Technology (PTU)
~20 Comb·
always beit""'
In sununarv. " 111 1"' . • d · d •• \Vrite 5ta d from an mteger data type before the case statement and back again after.,
s1·gnal assirr1m1cni ma v be preferable to avoid mtro ucmg a ditional, unwanted 1 , _a Seleo,. ~teJllent.
verte . n be cumbersome .
-. ' . ' "' " ogic · '"'d con h thlS ca
circuit. · · in Y%r al thoug
. Binary Encoder :
_ VHDL Modeling of Encoders : An s.3 .
49
_g.1 oder is modeled ac~ordmg to the truth table of Table 4.9.1 using the if, case
Discn:tc quantities
. of digital information., data, are often r e p r e tnsaeCodn ~ All g,3 ene
Stateme nt' and addumnally fo, VIIDL, eond,uo.,, '"" « leet<d , igo,J
A r for
binary bcmg the most popular. ed forni; 0
1
Encoders a.re used to enc~de discrete data into a coded form and decoders , 1 use
as11signments . a default assigned output value to avoid having to explicitly
. define
.. all
convert it back into its ong111al undecoded form . are Used to , mode s . ut conditions that should not occur under normal operating conditions.
2
An encoder
. that has 2n (or less) input lines encodes input data to . tv
s - 8 == 248 mp. nment is a " don ' t care" val ue to nurum1ze
· · . syn th es1ze
. d Iog1.c.
output Imes . n encoded
Th
8 · assig
e default put co nditions that are not explicitly defined default to binary 000, more
The rruth table for an 8-3 binary encoder (8 inputs and 3 outp ts . •• If all. 24ouldmbe syn thesized than is necessary.
Table .4.9.1. It is assumed that only one input has a value of 1 atu ~y 1
) ts •shown in
otherwise the output has some undefined value and the circuit is meam· ng1ess. given time ,
•
~ ~
i statement :
f. 8 -., Pnrrvvu
Fig. 4.9 .1 show s a Simulation waveform display of the above VHDL model. From
& Technology (PTU)
4-36 Combinational . n & Technology (PTU)
\/LS\ D .:..::::· Circuit
v~ - -
., fa-4.10.l : Truth table of 3;8 decoder when 5 => Y <= "00100000"·
. ·-· ,
-
0
. - r--- use JEEE.STD_LOGIC_ARITH .all;
1 0 1 0 0 1 0 0 0 0 0 a I use !EEE.~TD_LOGICUNSIGNED.all;
1 1 0 0 1 0 0 . 0 0 0 0
I 1 1 1 0 0 0 0 0 0 0
- entity Decoder3_8 is
1) Using Case statement : Port ( A: in integer range Oto 7;
Y: out std_logic_vector(7 downto O));
library IEEE;
use IEEE.STD_LOGIC_l 164.all, IEEE.NUMERIC_STD.all; end Decoder3_8;
--
when "0001" => ex3 <= "0100"; these we can conclude . that the functional simulation of binary to excess-3 converter is
when "0010" => ex3 <= "0101"; successful by satisfying the truth table.
when "0011" => ex3 <= "0110";
when "0100" => ex3 <= "1000";
'•~
Snalon W.Yffllnll look tleP • .. •
e,'',' ..-- ~~-.i i'o~t!-"~ «• C• "" '. ,iii.,, l
..
when "0101" => ex3 <= "1001"; ~ , :-~~~i~-~-:-i~~:~:.~1-~?1~_::.~ 1~·• ·... . ,..•·,. ,.........·
when "0110" => ex3 <= "1010";
.:,•,1~..,,1i,,,,.""" c..,.,
The follmving steps can be adopted to implement the Boolean e q uns a into
tio ~
\1t,-. oleanis ..
code. . . 'lllll tft)I bO C. in std_log1c/ .
en rt (A,B, • •)
I. First simplify the given Boolean equation using the Karnaugh' s map. po y: out std_log1c ;
2. Then realize the equation into circuit. boolean;,
3. By using the circuit diagram write the VHDL code using the dataflow end
- or struch,-'
method. . .... ill ~rchitecture equation of boolean is
4. You can also write the truth table for the simplified Boolean equation and then . signal s1, s2, s3, s4,s5:_std_logic;
table you can write the VHDL code in Behavioural modeling. using !hi&
begin
5. The data. flow method is one of the most common and simple method to imple sl<"' n?,t A;
/' Boolean equations because it generates the smaller and faster synthesized circuit. ment s2<= B xnor C;
Example 4.1 : Write down the VHDL code for following logical expression. - s3<= B xor C;
F (A,B,C) = k m (0, 3, 5, 6) s4<= s1 and s2;
Solution: ctB AB AB AB AB C B AB AB AB AB s5<= s3 and A;
- -- - . 00 01 11 10 Y<= s4 or s5;
1 0 01 1 .3 0. 2 coCDoCDo end equation;
0
4
,5
0_7 1• 6 C1 0 CD O CD Simulation :
Simplified Boolean equation Fig. P. 4.1.l(b) shows a simulation result for the above Boolean equation. At
y = Al!G:+ AeC + ABC + ABt = ABC + ABC + ABC + ABC instance 184.2 ns the inputs A, B, and C are 0, I and l respectively. Their corresponding
-- .
output can be verified from Table P. 4.1.1. It shows ~t ;uncti~nal simulation is successful.
y = A(BC + BC) + A (B CT BC) ii
Table P. 4.1.1 : Truth table for example 4.1
y = ~ C ) + A (BEBC)
A B C -
A B@C A_(BEBC) A(BEBC) y
The circuit realization · of above A B C (fiEBC)
simplified. Boolean equation is shown in
S1
'1 S1 S2 SJ s, Ss
Fig. P. 4.1.l(a). 0 I
0 0 0 1 1 0 1
Where, S1 = A 0 0 1 0 0 0
1 1 0
0 0 0 0-
S 2 = B@C 1 0 1 0 1
0 I
0 I I 1 I 0 1 -
S3 =B$C
0 ()
I 0 0 0 ' 1 0 0
S4 =
--
A(B.EBC) 1 I l \
I 0 I 0 0 l 0
\ \
S5 = A(BEBC) Fig. P. 4.1.l(a) I I 0 0 0 I 0
- I
_ __..-:-