Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Session 04 v.3
1. • Click to edit Master text styles
– Second level
• Third level
– Fourthg i t a l D e s i g n u s i n g V H D L
D i level
Session Four
» Fifth level
Introduced by
Cairo-Egypt
Version 03 – June 2012 1
2. about Start Group
• Click to edit Master text styles
Mahmoud Abdellatif
– Second level
Alaa Salah Shehata
Mohamed level
• Third Salah
Mohamed Talaat
– Fourth level
» Fifth level
start.courses@gmail.com www.slideshare.net/StartGroup
www.facebook.com/groups/start.group
www.startgroup.weebly.com Start.courses@gmail.com
+ 02 0122-4504158 M.A www.youtube.com/StartGroup2011
+ 02 0128-0090250 A.S
Session Four 2
3. mini-Project Discussion
Sel Operation
0000 Y<= a
• Click to edit Master text styles 0001 Y<= a+1
A(7:0) Logic 0010 Y<= a-1
– Second level
B(7:0) Unit 0011 Y<= b
• Third level C(7:0)
0100 Y<= b+1
0101 Y<= b-1
– Fourth level
Arithmetic 0110 Y<= a+b
» Fifth level
Unit 0111 Y<= a+b+cin
Cin
1000 Y<= not a
SEL(3:0)
1001 Y<= not b
1010 Y<= a AND b
1011 Y<= a OR b
1100 Y<= a NAND b
1101 Y<= a NOR b
Synchronous ALU
Using transcript & Pretty waveform 1110 Y<= a XOR b
1111 Y<= a XNOR b
Session Four 3
4. Outline
• Click to edit Master text styles
– Second level
• Third level
Data Operators
- Concatenation
- Aggregation
- Attributes
Counters and Shifting registers
4
– Fourth level
» Fifth level
Session Four 4
5. Outline
• Click to edit Master text styles
Data Operators
- Concatenation
– Second level - Aggregation
- Attributes
• Third level
– Fourth level Counters and Shifting registers
» Fifth level
Session Four 5
6. Data Operators [Concatenation]
• Click to edit Master text styles
Used to merge two operands together using the concatenation operator ( & ).
This result is an array in which length is the sum of lengths of both operands.
– Second level
C <= A & B
• Third level
– Fourth level
» Fifth level
A B
C
Session Four 6
7. Example 18
Shift Registers
• Click to edit Master text styles
– Second level
A <= 0 & A(7 downto 1);
--Shift right
A <= A(6 downto 0) & 0;
• Third level
--Shift left
– Fourth level
» Fifth level
A7 A0 A7 A0
0 0
A6 A0 A7 A1
Session Four 7
8. Example 19
Division/ Multiplication by 2^n
• Click to edit Master text styles
A7 A0
– Second level
A <= A(7) & A(7 downto 1);
--Shift right
• Third level
-- devision by 2
A <= A(6 downto 0) & A(0);
– left
--Shift Fourth level
-- Multiplication by 2
» Fifth level
-- Note (multiplication need
A7 A7 A1
one more bit for each shift)
A7 A7 A1
A7
Session Four 8
9. Example 20
Rotate Registers
• Click to edit Master text styles
– Second level
A <= A(0) & A(7 downto 1);
--Rotate right
A <= A(6 downto 0) & A(7);
• Third level
-- Rotate left
– Fourth level
» Fifth level
A7 A0 A7 A0
A6 A0 A7 A1
A7 A0
Session Four 9
10. Data Operators [Aggregation]
• Click to edit Master text styles
Provides an easy way of assigning objects of composite types
– Second level
The aggregate assigns values to a selected elements of an array or a record.
Keyword ‘others’ is used here
• Third level
– Fourth level
data : std_logic_vector(15 downto 0);
» Fifth level
data <= (15 downto 8 => '0' , others => '1');
-- data = 0000000011111111
data <= (1 | 4 | 7 => '1', 2 | 3 => '0', others => 'Z');
-- data = ZZZZZZZZ1ZZ1001Z
data <= (others => ‘1');
-- fill data with ones
Session Four 10
11. Data Operators [Attributes]
• Click to edit Master text styles
Attributes can be used to poll characteristics/information of objects (e.g. signals).
– Second level
The general form of an attribute name is name'attribute_identifier.
• Third level
The most commonly used attribute is 'EVENT, used to detect and trigger activity at a
certain clock edge (for example rising edge) only.
– Fourth level
if (clk’event and clk = ‘1’) then
» Fifth level
Examples of attributes :
‘left, ‘right, ‘high, ‘length, ’range, ‘event, …
Note
Pronounce the apostrophe as “tick “
Session Four 11
12. Outline
• Click to edit Master text styles
Data Operators
- Concatenation
– Second level - Aggregation
- Attributes
• Third level
– Fourth level Counters and Shifting registers
» Fifth level
Session Four 12
13. Lab 04
• Click to edit Master text styles
Title:
– Second level
COUNTERS in VHDL
Goal: • Third level
Be familiar with implementations of different counter schemes
– Fourth level
» Fifth level
Session Four 13
14. Lab 04
4-bit Free binary counter
• Click to edit Master text styles
Library ieee;
use ieee.std_logic_1164.all;
– Second level
use ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;
Entity counter is
• Third level
Port( clk, rst : in std_logic;
count : out std_logic_vector(3 downto 0));
end entity;
– Fourth level
Architecture behav » Fifth level
of d_ff is
Signal count_i : std_logic_vector(7 downto 0);
Begin
process(clk, rst)
begin
If (rst = '1') then
count_i <= "00000000";
elsif rising_edge(clk) then
count_i <= count_i + '1';
end if;
end process;
count <= count_i;
end behav;
Session Four 14
15. Lab 04
• Click to edit Master text styles
4-Bit binary Counter with Synchronous/Asynchronous load
– Second level
• Third
Assignment level
– Fourth level
» Fifth level
Session Four 15
16. Lab 04
• Click to edit Master text styles
4-Bit binary UP-Down Counter
– Second level
• Third
Assignment level
– Fourth level
» Fifth level
Session Four 16
17. Lab 05
• Click to edit Master text styles
Title:
– Second level
Rotating LEDs
Goal: • Third level
Be familiar with Shift registers
– Fourth level
» Fifth level
Session Four 17
18. Lab 05
• Click to edit Master text styles
One way rotating LEDs
– Second level
• Third
Assignment level
– Fourth level
» Fifth level
Session Four 18
19. Lab 05
• Click to edit Master text styles
Two ways rotating LEDs
– Second level
• Third
Assignment level
– Fourth level
» Fifth level
Session Four 19
20. Start Notes [Synthesis Notes]
• Click to edit Master text styles
– Second level Example : Write a code describing this Adder
Area Optimization Note that the selector can select one addition at a time, the
• Third level operators are mutually exclusive
During writing a code for
implementation – Fourth level
you must OpSel Function
save your resources, many
» Fifth level 00 A+B
ways maybe used to
reduce area used from 01 C+D
your FPGA. Here, we will 10 E+F
introduce an example of
thinking how to reduce 11 G+H
your area in your design.
Session Four 20
21. Start Notes [Synthesis Notes]
• Click to edit Master text styles
It is better to write a code that describe the circuit on the right as adders take much bigger
– Second level
area than multiplexers
his transformation of operators is called Resource Sharing
• Third level
– Fourth level
» Fifth level
Session Four 21
22. Start Notes [Synthesis Notes]
• Click to edit Master text styles
Possible Solutions
Solution 1
– Second level
process (OpSel,A,B,C,D,E,F,G,H)
begin
case OpSel is
• Third level
when "00" => Z <= A + B ;
when "01" => Z
– Fourth level => Z <= C + D ;
when "10" <= E + F ;
» Fifth level
when "11" => Z <= G + H ;
when others => Z <= ‘0’ ;
end case ;
end process ;
Here the code is Tool Driven Resource Sharing, the tool understand that we don’t need to
make four adders and one Adder is implemented.
General Note
To ensure resource sharing, operators must be coded in the same process, and same code
(case or if) structure.
Session Four 22
23. Start Notes [Synthesis Notes]
Possible Solutions
• Click to edit Master text styles
Solution 2
X <= Mux4(OpSel, A, C, E, G) ; -- 4x1 MUX in vhdl
– Second level
Y <= Mux4(OpSel, B, D, F, H) ;
Z <= X + Y ;
• Third level
Here the code is Code Drivenlevel
– Fourth Resource Sharing, You forced the tool to use only one Adder.
Solution 3 » Fifth level
Process (OpSel, A, B, C, D, E, F, G, H)
begin
if (OpSel = "00") then Z <= A + B; end if;
if (OpSel = "01") then Z <= C + D; end if;
if (OpSel = "10") then Z <= E + F; end if;
if (OpSel = "11") then Z <= G + H; end if;
end process ;
Bad Code that may defeat Resource Sharing.
Synthesis tool may create a separate resource for each adder. Don’t do that!
Session Four 23
24. Summary
• Counters are essential in Master text styles
- Click to edit most of design blocks.
- Different types of counters can be implemented using vhdl
– Second level
- Free Counters
- UP-DOWN Counters
• Third
- BDC Counterslevel
- Counters with external LOAD signals
-
– Fourth level
Shift Registers are also important for Dividing and Multiplying by 2 and also for Parallel to Serial
» Fifth level
and Serial to Parallel conversion.
Examples Exercises Labs
18-20 - 4-5
Session Four 24
25. Time for Your Questions
• Click to edit Master text styles
– Second level
• Third level
– Fourth level
» Fifth level
Session Four 25
26. Download Session 04 Files
• Click to edit Master text styles
–Attributes www.startgroup.weebly.com/vhdl-examples.html
Second level
• Third level
– Fourth level
Example on Do Fifth level
» file www.startgroup.weebly.com/vhdl-examples.htm
Session Four 26
27. Take Your Notes
Print the slides and take your notes here
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
• Click to edit Master text styles
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
– Second level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
• Third level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
– Fourth level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
» Fifth level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
28. See You Next Session .. Don’t miss
• Click to edit Master text styles
– Second level
• Third level
– Fourth level
Thank
» Fifth level
You