Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
• 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...
about Start Group• Click to edit Master text styles   Mahmoud Abdellatif  – Second level  Alaa Salah Shehata   Mohamed lev...
mini-Project Discussion                                                              Sel    Operation                     ...
Outline• Click to edit Master text styles   – Second level      • Third level                       Data Operators        ...
Outline• Click to edit Master text styles                       Data Operators                               - Concatenati...
Data Operators                      [Concatenation]• Click to edit Master text stylesUsed to merge two operands together u...
Example 18Shift Registers • Click to edit Master text styles      – Second levelA <= 0 & A(7 downto 1);         --Shift ri...
Example 19Division/ Multiplication by 2^n • Click to edit Master text styles                                 A7           ...
Example 20Rotate Registers • Click to edit Master text styles      – Second levelA <= A(0) & A(7 downto 1);         --Rota...
Data Operators                       [Aggregation]• Click to edit Master text stylesProvides an easy way of assigning obje...
Data Operators                       [Attributes]• Click to edit Master text stylesAttributes can be used to poll characte...
Outline• Click to edit Master text styles                       Data Operators                               - Concatenati...
Lab 04• Click to edit Master text stylesTitle:        – Second levelCOUNTERS in VHDLGoal:      • Third level             ...
Lab 044-bit Free binary counter • Click to edit Master text stylesLibrary ieee;use ieee.std_logic_1164.all;      – Second ...
Lab 04 • Click to edit Master text styles4-Bit binary Counter with Synchronous/Asynchronous load     – Second level       ...
Lab 04 • Click to edit Master text styles4-Bit binary UP-Down Counter     – Second level         • Third      Assignment  ...
Lab 05• Click to edit Master text stylesTitle:        – Second levelRotating LEDsGoal:      • Third level               B...
Lab 05 • Click to edit Master text stylesOne way rotating LEDs     – Second level         • Third      Assignment   level ...
Lab 05 • Click to edit Master text stylesTwo ways rotating LEDs     – Second level          • Third       Assignment   lev...
Start Notes          [Synthesis Notes]• Click to edit Master text styles     – Second level Example : Write a code describ...
Start Notes            [Synthesis Notes]• Click to edit Master text stylesIt is better to write a code that describe the c...
Start Notes        [Synthesis Notes]• Click to edit Master text stylesPossible Solutions           Solution 1      – Secon...
Start Notes             [Synthesis Notes]Possible Solutions• Click to edit Master text styles           Solution 2X <= Mux...
Summary• Counters are essential in Master text styles-  Click to edit most of design blocks.-   Different types of counter...
Time for Your Questions• Click to edit Master text styles  – Second level     • Third level        – Fourth level         ...
Download Session 04 Files• Click to edit Master text styles  –Attributes www.startgroup.weebly.com/vhdl-examples.html    S...
Take Your Notes                                       Print the slides and take your notes here---------------------------...
See You Next Session .. Don’t miss• Click to edit Master text styles  – Second level     • Third level        – Fourth lev...
Upcoming SlideShare
Loading in …5
×

Session 04 v.3

462 views

Published on

Published in: Business, Technology
  • Be the first to comment

  • Be the first to like this

Session 04 v.3

  1. 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. 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. 3. mini-Project Discussion Sel Operation 0000 Y<= a• Click to edit Master text styles 0001 Y<= a+1A(7:0) Logic 0010 Y<= a-1 – Second levelB(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 aSEL(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. 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. 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. 6. Data Operators [Concatenation]• Click to edit Master text stylesUsed 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. 7. Example 18Shift Registers • Click to edit Master text styles – Second levelA <= 0 & A(7 downto 1); --Shift rightA <= 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. 8. Example 19Division/ Multiplication by 2^n • Click to edit Master text styles A7 A0 – Second levelA <= A(7) & A(7 downto 1); --Shift right • Third level -- devision by 2A <= A(6 downto 0) & A(0); – left --Shift Fourth level -- Multiplication by 2 » Fifth level -- Note (multiplication need A7 A7 A1one more bit for each shift) A7 A7 A1 A7 Session Four 8
  9. 9. Example 20Rotate Registers • Click to edit Master text styles – Second levelA <= A(0) & A(7 downto 1); --Rotate rightA <= 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. 10. Data Operators [Aggregation]• Click to edit Master text stylesProvides an easy way of assigning objects of composite types – Second levelThe aggregate assigns values to a selected elements of an array or a record.Keyword ‘others’ is used here • Third level – Fourth leveldata : std_logic_vector(15 downto 0); » Fifth leveldata <= (15 downto 8 => 0 , others => 1); -- data = 0000000011111111data <= (1 | 4 | 7 => 1, 2 | 3 => 0, others => Z); -- data = ZZZZZZZZ1ZZ1001Zdata <= (others => ‘1); -- fill data with ones Session Four 10
  11. 11. Data Operators [Attributes]• Click to edit Master text stylesAttributes can be used to poll characteristics/information of objects (e.g. signals). – Second levelThe general form of an attribute name is nameattribute_identifier. • Third levelThe most commonly used attribute is EVENT, used to detect and trigger activity at acertain clock edge (for example rising edge) only. – Fourth level if (clk’event and clk = ‘1’) then » Fifth levelExamples of attributes :‘left, ‘right, ‘high, ‘length, ’range, ‘event, …Note Pronounce the apostrophe as “tick “ Session Four 11
  12. 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. 13. Lab 04• Click to edit Master text stylesTitle: – Second levelCOUNTERS in VHDLGoal: • Third level  Be familiar with implementations of different counter schemes – Fourth level » Fifth level Session Four 13
  14. 14. Lab 044-bit Free binary counter • Click to edit Master text stylesLibrary ieee;use ieee.std_logic_1164.all; – Second leveluse ieee.std_logic_arith.all;use ieee.std_logic_signed.all;Entity counter is • Third levelPort( clk, rst : in std_logic; count : out std_logic_vector(3 downto 0));end entity; – Fourth levelArchitecture 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. 15. Lab 04 • Click to edit Master text styles4-Bit binary Counter with Synchronous/Asynchronous load – Second level • Third Assignment level – Fourth level » Fifth level Session Four 15
  16. 16. Lab 04 • Click to edit Master text styles4-Bit binary UP-Down Counter – Second level • Third Assignment level – Fourth level » Fifth level Session Four 16
  17. 17. Lab 05• Click to edit Master text stylesTitle: – Second levelRotating LEDsGoal: • Third level  Be familiar with Shift registers – Fourth level » Fifth level Session Four 17
  18. 18. Lab 05 • Click to edit Master text stylesOne way rotating LEDs – Second level • Third Assignment level – Fourth level » Fifth level Session Four 18
  19. 19. Lab 05 • Click to edit Master text stylesTwo ways rotating LEDs – Second level • Third Assignment level – Fourth level » Fifth level Session Four 19
  20. 20. Start Notes [Synthesis Notes]• Click to edit Master text styles – Second level Example : Write a code describing this AdderArea Optimization Note that the selector can select one addition at a time, the • Third level operators are mutually exclusiveDuring writing a code forimplementation – Fourth level you must OpSel Functionsave your resources, many » Fifth level 00 A+Bways maybe used toreduce area used from 01 C+Dyour FPGA. Here, we will 10 E+Fintroduce an example ofthinking how to reduce 11 G+Hyour area in your design. Session Four 20
  21. 21. Start Notes [Synthesis Notes]• Click to edit Master text stylesIt is better to write a code that describe the circuit on the right as adders take much bigger – Second levelarea than multiplexershis transformation of operators is called Resource Sharing • Third level – Fourth level » Fifth level Session Four 21
  22. 22. Start Notes [Synthesis Notes]• Click to edit Master text stylesPossible Solutions Solution 1 – Second levelprocess (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 tomake four adders and one Adder is implemented.General NoteTo ensure resource sharing, operators must be coded in the same process, and same code(case or if) structure. Session Four 22
  23. 23. Start Notes [Synthesis Notes]Possible Solutions• Click to edit Master text styles Solution 2X <= Mux4(OpSel, A, C, E, G) ; -- 4x1 MUX in vhdl – Second levelY <= Mux4(OpSel, B, D, F, H) ;Z <= X + Y ; • Third levelHere the code is Code Drivenlevel – Fourth Resource Sharing, You forced the tool to use only one Adder. Solution 3 » Fifth levelProcess (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. 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. 25. Time for Your Questions• Click to edit Master text styles – Second level • Third level – Fourth level » Fifth level Session Four 25
  26. 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. 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. 28. See You Next Session .. Don’t miss• Click to edit Master text styles – Second level • Third level – Fourth level Thank » Fifth level You

×