SlideShare una empresa de Scribd logo
1 de 29
VHDL 360© by: Mohamed Samy         Samer El-Saadany
Copyrights Copyright © 2010/2011 to authors. All rights reserved All content in this presentation, including charts, data, artwork and logos (from here on, "the Content"), is the property of Mohamed Samy and Samer El-Saadany or the corresponding owners, depending on the circumstances of publication, and is protected by national and international copyright laws. Authors are not personally liable for your usage of the Content that entailed casual or indirect destruction of anything or actions entailed to information profit loss or other losses. Users are granted to access, display, download and print portions of this presentation, solely for their own personal non-commercial use, provided that all proprietary notices are kept intact.  Product names and trademarks mentioned in this presentation belong to their respective owners. VHDL 360 © 2
Module 4 Synthesis Examples
Objective Getting familiar with code changes' impact on synthesis Skills gained: Writing synthesis friendly code VHDL 360 © 4
Outline Introduction Synthesize and Learn Combinational Logic Latch Inference Sequential Logic Flip-Flop Inference VHDL 360 © 5
Introduction VHDL 360 © 6 VHDL is a H/W modeling language used to model digital circuits Digital circuits can be either Combinational or Sequential Combinational Logic circuits: Implement Boolean functions whose output is only dependant on the present inputs Sequential Logic circuits: Implement circuits whose output depends on the present inputs & the history of the inputs. i.e. Circuits having storage elements
Introduction VHDL 360 © 7 VHDL Standard Synthesizable VHDL Synthesis tools translate the VHDL code to a gate level netlist representing the actual H/W gates [and, or, not, Flip-Flops…etc] Only a subset of the language is synthesizable A model can be either Synthesizable: Used for both Simulation & Synthesis Non-Synthesizable:  Used for Simulation only
Synthesize And Learn 8
Synthesize and Learn In the next slides we will use examples from the previous modules to demonstrate synthesis and study the synthesized logic We will also modify these examples and observe the impact on the synthesized logic 9 VHDL 360 ©
Combinational Logic libraryIEEE; useIEEE.std_logic_1164.all; Entitymux_caseis  Port(a, b, c, d:instd_logic; Sel:instd_logic_vector(1downto0);       F:outstd_logic); Endentity; Architecture rtl ofmux_caseis begin   process(a,b,c,d,sel)is begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase;   Endprocess; Endarchitecture; VHDL 360 © 10 Example 1: 4x1 Multiplexer
Skills Check ,[object Object],Architecture rtl ofmux_caseis begin   process(a,b,c,d,sel)is begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase;   Endprocess; Endarchitecture; VHDL 360 © 11 Example 1: 4x1 Multiplexer Example 2: 4x1 Multiplexer  Architecture rtl ofmux_caseis begin   process(a, sel)is begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase;   Endprocess; Endarchitecture;
Skills Check (Soln.) Architecture rtl ofmux_caseis begin   process(a,b,c,d,sel)is begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase;   Endprocess; Endarchitecture; VHDL 360 © 12 ,[object Object]
Synthesis tools don’t use the sensitivity list to determine the logic, but simulation tools depend on the sensitivity list to execute the process
Example 2 suffers a problem called “Simulation – Synthesis mismatch”Example 1: 4x1 Multiplexer Example 2: 4x1 Multiplexer Architecture rtl ofmux_caseis begin   process(a, sel)is begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase;   Endprocess; Endarchitecture;
Combinational Logic ,[object Object],Architecture rtl ofmux_caseis begin   process(all)is   begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase;   Endprocess; Endarchitecture; VHDL 360 © 13 Example 3 Golden rule of thumb ,[object Object],*Not yet supported by all tools in the market
Combinational Logic 14 VHDL 360 © Example 4: Adder-Subtractor LIBRARYieee; USEieee.std_logic_1164.all; USEieee.std_logic_arith.all; ENTITYadd_subIS port(a, b :ininteger;         result :outinteger; operation:instd_logic); ENDENTITY; ARCHITECTURE behave OFadd_subIS BEGIN process(a, b, operation) begin if(operation = '1')then result <= a + b; else           result <= a - b; endif; endprocess; ENDARCHITECTURE;
Combinational Logic 15 VHDL 360 © Consider that someone tries to re-use that code to implement an adder with an enable  He modifies the add_sub example; removes the else branch & renames the “operation” port to “enable” as shown below, How would these changes affect the logic? Example 5: LIBRARYieee; USEieee.std_logic_1164.all; USEieee.std_logic_arith.all; ENTITY adder IS port(a, b :ininteger;         result :outinteger; enable:instd_logic); ENDENTITY adder; ARCHITECTURE behave OF adder IS BEGIN process(a, b, enable) begin if(enable = '1')then  result <= a + b; endif; endprocess; ENDARCHITECTURE;
Combinational Logic 16 VHDL 360 © This will infer a latch, because we didn’t specify what should happen to “result” when “enable” isn’t equal to '1' Simulation & synthesis tools will just keep the value as is…i.e. It latches the last value Example 5: LIBRARYieee; USEieee.std_logic_1164.all; USEieee.std_logic_arith.all; ENTITY adder IS port(a, b :ininteger;         result :outinteger; enable:instd_logic); ENDENTITY adder; ARCHITECTURE behave OF adder IS BEGIN process(a, b, enable) begin if(enable = '1')then  result <= a + b; endif; endprocess; ENDARCHITECTURE;
Combinational Logic In the below example, the "11" value of "sel" signal is not listed as a case choice, hence signal "F" is not assigned a value in this case A Latch is inferred in this example  Probably that wasn’t needed Example 6: LIBRARYieee; USEieee.std_logic_1164.all; ENTITYincomplete_caseIS port(sel:std_logic_vector(1downto0);        A, B:std_logic;        F   :outstd_logic); ENDENTITY; ARCHITECTURE rtl OFincomplete_caseIS BEGIN   process(sel, A, B)   begin     case(sel)is     when"00"=>       F <= A;     when"01"=>       F <= B;     when"10"=>       F <= A xor B;     whenothers=>null;     endcase;   endprocess; ENDARCHITECTURE; 17 VHDL 360 ©
Skills Check Do you think a Latch would be inferred in the below example? Example 7: LIBRARYieee; USEieee.std_logic_1164.all; ENTITYincomplete_assignmentIS   port(sel:instd_logic_vector(1downto0);        A, B  :instd_logic;        O1, O2:outstd_logic); ENDENTITY; ARCHITECTURE rtl OFincomplete_assignmentIS BEGIN   process(sel, A, B)begin     case(sel)is     when"00"=>       O1 <= A;       O2 <= A and B;     when"01"=>       O1 <= B;       O2 <= A xor B;     when"10"=>       O1 <= A xor B;     when"11"=>       O2 <= A or B;     whenothers=>       O1 <= '0';       O2 <= '0';     endcase;   endprocess; ENDARCHITECTURE; 18 VHDL 360 ©
Skills Check (Soln.) Example 7: LIBRARYieee; USEieee.std_logic_1164.all; ENTITYincomplete_assignmentIS   port(sel:instd_logic_vector(1downto0);        A, B  :instd_logic;        O1, O2:outstd_logic); ENDENTITY; ARCHITECTURE rtl OFincomplete_assignmentIS BEGIN   process(sel, A, B)begin     case(sel)is     when"00"=>       O1 <= A;       O2 <= A and B;     when"01"=>       O1 <= B;       O2 <= A xor B;     when"10"=>       O1 <= A xor B;     when"11"=>       O2 <= A or B;     whenothers=>       O1 <= '0';       O2 <= '0';     endcase;   endprocess; ENDARCHITECTURE; 19 VHDL 360 © Do you think a Latch would be inferred in the below example? ,[object Object]
Though the case is complete & no "null" statement is there, we find that "O1" & "O2" are not assigned in all case's branches  This is called “Incomplete signal assignment”,[object Object]
Enough CombinationalLet's Go Sequential 21
Sequential Logic 22 VHDL 360 © ,[object Object],Example 8: Libraryieee; useieee.std_logic_1164.all; Entity d_ff is Port(d, clk, rst :instd_logic; Q, nQ :outstd_logic); endentity; Architecture behav of d_ff is Begin process(clk) begin If(rising_edge(clk))then If(rst = '1')then          Q <= '0';          nQ <= '0';        else          Q <= d;          nQ <=not (d);        endif;      endif; endprocess; end behav;
Sequential Logic 23 VHDL 360 © ,[object Object],Example 8: Libraryieee; useieee.std_logic_1164.all; Entity d_ff is Port(d, clk, rst :instd_logic; Q, nQ :outstd_logic); endentity; Architecture behav of d_ff is Begin process(clk) begin If(rising_edge(clk))then If(rst = '1')then          Q <= '0';          nQ <='1';        else          Q <= d;          nQ <=not (d);        endif;      endif; endprocess; end behav; Two Flip-Flops ?! Change the code to have only one Flip-Flop
Sequential Logic 24 VHDL 360 © ,[object Object],Example 9: Libraryieee; useieee.std_logic_1164.all; Entity d_ff is Port( d, clk, rst :instd_logic;  Q, nQ :outstd_logic); endentity; Architecture behav of d_ff is signal Q_int:std_logic; Begin process(clk) begin If(rising_edge(clk))then If(rst = '1')then          Q_int <= '0';        else         Q_int <= d;        endif;      endif; endprocess; Q <= Q_int; nQ <=not (Q_int); end behav; Yep…That's what we want!
Sequential Logic 25 VHDL 360 © ,[object Object],Example 10: Libraryieee; useieee.std_logic_1164.all; Entity d_ffs is Port(d: std_logic_vector(3downto0); clk, rst :instd_logic; Q, nQ :outstd_logic_vector(3downto0)); endentity; Architecture behav of d_ffs is signal Q_int:std_logic_vector(3downto0); Begin process(clk) begin If(rising_edge(clk))then If(rst = '1')then          Q_int <= (others => '0');        else         Q_int <= d;        endif;      endif; endprocess; Q <= Q_int; nQ <=not (Q_int); end behav;
Sequential Logic Example 11: 8-bit Shift Register (Shift right) Libraryieee; useieee.std_logic_1164.all; entity shift_register is   Port( clk, D, enable :inSTD_LOGIC;    Q :outSTD_LOGIC); endentity; architecture Behavioral of shift_register is begin process(clk) variable reg:std_logic_vector(7downto0); begin ifrising_edge(clk)then if enable = '1' then for i in1to7loop           reg(i-1):= reg(i); endloop;         reg(7):= d; endif; endif;     Q <= reg(0);   endprocess; end Behavioral; 7    6    5   4    3    2    1    0 VHDL 360 © 26
Flip-Flop Inference Assignments under clock edge where the object value needs to be remembered across multiple process invocations  Flip-Flop Signal assignment under clock edge will always infer a Flip-Flop Variable assignment under clock edge will infer Flip-Flop only when its value ought to be remembered across process invocations 27 VHDL 360 ©

Más contenido relacionado

La actualidad más candente

The Curse By A Yi.pptx
The Curse By A Yi.pptxThe Curse By A Yi.pptx
The Curse By A Yi.pptxLeaCastillo7
 
The indolence og the fil.chapter 5
The indolence og the fil.chapter 5The indolence og the fil.chapter 5
The indolence og the fil.chapter 5gurLie Manuel
 
sagisag kultura ng mga kalanguya
sagisag kultura ng mga kalanguya sagisag kultura ng mga kalanguya
sagisag kultura ng mga kalanguya Roger Sebastian
 
Alan Turing: Founder of Computer Science
Alan Turing: Founder of Computer ScienceAlan Turing: Founder of Computer Science
Alan Turing: Founder of Computer ScienceJonathan Bowen
 
Rizal’s nationalism
Rizal’s nationalismRizal’s nationalism
Rizal’s nationalismYana Collins
 
PE 7-2nd Quarter Arnis-Striking Techniques
PE 7-2nd Quarter Arnis-Striking TechniquesPE 7-2nd Quarter Arnis-Striking Techniques
PE 7-2nd Quarter Arnis-Striking TechniquesMerra Mae Ramos
 
Narrative - Sikolohiyang Pilipino
Narrative - Sikolohiyang PilipinoNarrative - Sikolohiyang Pilipino
Narrative - Sikolohiyang PilipinoJeanelei Carolino
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog Pushpa Yakkala
 
Tatlong batayang kategorya sa mga layuning pampagtuturo
Tatlong batayang kategorya sa mga layuning pampagtuturoTatlong batayang kategorya sa mga layuning pampagtuturo
Tatlong batayang kategorya sa mga layuning pampagtuturoKareen Mae Adorable
 

La actualidad más candente (11)

The Curse By A Yi.pptx
The Curse By A Yi.pptxThe Curse By A Yi.pptx
The Curse By A Yi.pptx
 
The indolence og the fil.chapter 5
The indolence og the fil.chapter 5The indolence og the fil.chapter 5
The indolence og the fil.chapter 5
 
sagisag kultura ng mga kalanguya
sagisag kultura ng mga kalanguya sagisag kultura ng mga kalanguya
sagisag kultura ng mga kalanguya
 
Alan Turing: Founder of Computer Science
Alan Turing: Founder of Computer ScienceAlan Turing: Founder of Computer Science
Alan Turing: Founder of Computer Science
 
Chapter 20
Chapter 20Chapter 20
Chapter 20
 
Rizal’s nationalism
Rizal’s nationalismRizal’s nationalism
Rizal’s nationalism
 
PE 7-2nd Quarter Arnis-Striking Techniques
PE 7-2nd Quarter Arnis-Striking TechniquesPE 7-2nd Quarter Arnis-Striking Techniques
PE 7-2nd Quarter Arnis-Striking Techniques
 
Narrative - Sikolohiyang Pilipino
Narrative - Sikolohiyang PilipinoNarrative - Sikolohiyang Pilipino
Narrative - Sikolohiyang Pilipino
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog
 
Raymond Magpulong
Raymond MagpulongRaymond Magpulong
Raymond Magpulong
 
Tatlong batayang kategorya sa mga layuning pampagtuturo
Tatlong batayang kategorya sa mga layuning pampagtuturoTatlong batayang kategorya sa mga layuning pampagtuturo
Tatlong batayang kategorya sa mga layuning pampagtuturo
 

Similar a Synthesis Examples

Create your first model for a simple logic circuit
Create your first model for a simple logic circuitCreate your first model for a simple logic circuit
Create your first model for a simple logic circuitMohamed Samy
 
Writing more complex models
Writing more complex modelsWriting more complex models
Writing more complex modelsMohamed Samy
 
Writing more complex models (continued)
Writing more complex models (continued)Writing more complex models (continued)
Writing more complex models (continued)Mohamed Samy
 
Building Hierarchy
Building HierarchyBuilding Hierarchy
Building HierarchyMohamed Samy
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDLMohamed Samy
 
Learning vhdl by examples
Learning vhdl by examplesLearning vhdl by examples
Learning vhdl by examplesanishgoel
 
Verilog overview
Verilog overviewVerilog overview
Verilog overviewposdege
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping newaprilyyy
 
Ds02 flow chart and pseudo code
Ds02 flow chart and pseudo codeDs02 flow chart and pseudo code
Ds02 flow chart and pseudo codejyoti_lakhani
 
Google mock training
Google mock trainingGoogle mock training
Google mock trainingThierry Gayet
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kimkimberly_Bm10203
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.gerrell
 
Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Béo Tú
 
learning vhdl by examples
learning vhdl by exampleslearning vhdl by examples
learning vhdl by examplesanishgoel
 
Prepare a Verilog HDL code for the following register Positive Edge.pdf
Prepare a Verilog HDL code for the following register  Positive Edge.pdfPrepare a Verilog HDL code for the following register  Positive Edge.pdf
Prepare a Verilog HDL code for the following register Positive Edge.pdfezonesolutions
 
Basic Coding In VHDL COding
Basic Coding In VHDL COdingBasic Coding In VHDL COding
Basic Coding In VHDL COdinganna university
 

Similar a Synthesis Examples (20)

Unit v. HDL Synthesis Process
Unit v. HDL Synthesis ProcessUnit v. HDL Synthesis Process
Unit v. HDL Synthesis Process
 
Create your first model for a simple logic circuit
Create your first model for a simple logic circuitCreate your first model for a simple logic circuit
Create your first model for a simple logic circuit
 
Writing more complex models
Writing more complex modelsWriting more complex models
Writing more complex models
 
Writing more complex models (continued)
Writing more complex models (continued)Writing more complex models (continued)
Writing more complex models (continued)
 
Building Hierarchy
Building HierarchyBuilding Hierarchy
Building Hierarchy
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
&lt;img src="xss.com">
&lt;img src="xss.com">&lt;img src="xss.com">
&lt;img src="xss.com">
 
Fav
FavFav
Fav
 
Learning vhdl by examples
Learning vhdl by examplesLearning vhdl by examples
Learning vhdl by examples
 
Verilog overview
Verilog overviewVerilog overview
Verilog overview
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
Ds02 flow chart and pseudo code
Ds02 flow chart and pseudo codeDs02 flow chart and pseudo code
Ds02 flow chart and pseudo code
 
Google mock training
Google mock trainingGoogle mock training
Google mock training
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
 
Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014
 
learning vhdl by examples
learning vhdl by exampleslearning vhdl by examples
learning vhdl by examples
 
Prepare a Verilog HDL code for the following register Positive Edge.pdf
Prepare a Verilog HDL code for the following register  Positive Edge.pdfPrepare a Verilog HDL code for the following register  Positive Edge.pdf
Prepare a Verilog HDL code for the following register Positive Edge.pdf
 
Basic Coding In VHDL COding
Basic Coding In VHDL COdingBasic Coding In VHDL COding
Basic Coding In VHDL COding
 
My final requirement
My final requirementMy final requirement
My final requirement
 

Último

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 

Último (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

Synthesis Examples

  • 1. VHDL 360© by: Mohamed Samy Samer El-Saadany
  • 2. Copyrights Copyright © 2010/2011 to authors. All rights reserved All content in this presentation, including charts, data, artwork and logos (from here on, "the Content"), is the property of Mohamed Samy and Samer El-Saadany or the corresponding owners, depending on the circumstances of publication, and is protected by national and international copyright laws. Authors are not personally liable for your usage of the Content that entailed casual or indirect destruction of anything or actions entailed to information profit loss or other losses. Users are granted to access, display, download and print portions of this presentation, solely for their own personal non-commercial use, provided that all proprietary notices are kept intact. Product names and trademarks mentioned in this presentation belong to their respective owners. VHDL 360 © 2
  • 4. Objective Getting familiar with code changes' impact on synthesis Skills gained: Writing synthesis friendly code VHDL 360 © 4
  • 5. Outline Introduction Synthesize and Learn Combinational Logic Latch Inference Sequential Logic Flip-Flop Inference VHDL 360 © 5
  • 6. Introduction VHDL 360 © 6 VHDL is a H/W modeling language used to model digital circuits Digital circuits can be either Combinational or Sequential Combinational Logic circuits: Implement Boolean functions whose output is only dependant on the present inputs Sequential Logic circuits: Implement circuits whose output depends on the present inputs & the history of the inputs. i.e. Circuits having storage elements
  • 7. Introduction VHDL 360 © 7 VHDL Standard Synthesizable VHDL Synthesis tools translate the VHDL code to a gate level netlist representing the actual H/W gates [and, or, not, Flip-Flops…etc] Only a subset of the language is synthesizable A model can be either Synthesizable: Used for both Simulation & Synthesis Non-Synthesizable: Used for Simulation only
  • 9. Synthesize and Learn In the next slides we will use examples from the previous modules to demonstrate synthesis and study the synthesized logic We will also modify these examples and observe the impact on the synthesized logic 9 VHDL 360 ©
  • 10. Combinational Logic libraryIEEE; useIEEE.std_logic_1164.all; Entitymux_caseis Port(a, b, c, d:instd_logic; Sel:instd_logic_vector(1downto0); F:outstd_logic); Endentity; Architecture rtl ofmux_caseis begin process(a,b,c,d,sel)is begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase; Endprocess; Endarchitecture; VHDL 360 © 10 Example 1: 4x1 Multiplexer
  • 11.
  • 12.
  • 13. Synthesis tools don’t use the sensitivity list to determine the logic, but simulation tools depend on the sensitivity list to execute the process
  • 14. Example 2 suffers a problem called “Simulation – Synthesis mismatch”Example 1: 4x1 Multiplexer Example 2: 4x1 Multiplexer Architecture rtl ofmux_caseis begin process(a, sel)is begin Caseselis When"00"=> f <= a; When"01"=> f <= b; When"10"=> f <= c; When"11"=> f <= d; whenothers=> f <= a; Endcase; Endprocess; Endarchitecture;
  • 15.
  • 16. Combinational Logic 14 VHDL 360 © Example 4: Adder-Subtractor LIBRARYieee; USEieee.std_logic_1164.all; USEieee.std_logic_arith.all; ENTITYadd_subIS port(a, b :ininteger; result :outinteger; operation:instd_logic); ENDENTITY; ARCHITECTURE behave OFadd_subIS BEGIN process(a, b, operation) begin if(operation = '1')then result <= a + b; else result <= a - b; endif; endprocess; ENDARCHITECTURE;
  • 17. Combinational Logic 15 VHDL 360 © Consider that someone tries to re-use that code to implement an adder with an enable  He modifies the add_sub example; removes the else branch & renames the “operation” port to “enable” as shown below, How would these changes affect the logic? Example 5: LIBRARYieee; USEieee.std_logic_1164.all; USEieee.std_logic_arith.all; ENTITY adder IS port(a, b :ininteger; result :outinteger; enable:instd_logic); ENDENTITY adder; ARCHITECTURE behave OF adder IS BEGIN process(a, b, enable) begin if(enable = '1')then result <= a + b; endif; endprocess; ENDARCHITECTURE;
  • 18. Combinational Logic 16 VHDL 360 © This will infer a latch, because we didn’t specify what should happen to “result” when “enable” isn’t equal to '1' Simulation & synthesis tools will just keep the value as is…i.e. It latches the last value Example 5: LIBRARYieee; USEieee.std_logic_1164.all; USEieee.std_logic_arith.all; ENTITY adder IS port(a, b :ininteger; result :outinteger; enable:instd_logic); ENDENTITY adder; ARCHITECTURE behave OF adder IS BEGIN process(a, b, enable) begin if(enable = '1')then result <= a + b; endif; endprocess; ENDARCHITECTURE;
  • 19. Combinational Logic In the below example, the "11" value of "sel" signal is not listed as a case choice, hence signal "F" is not assigned a value in this case A Latch is inferred in this example  Probably that wasn’t needed Example 6: LIBRARYieee; USEieee.std_logic_1164.all; ENTITYincomplete_caseIS port(sel:std_logic_vector(1downto0); A, B:std_logic; F :outstd_logic); ENDENTITY; ARCHITECTURE rtl OFincomplete_caseIS BEGIN process(sel, A, B) begin case(sel)is when"00"=> F <= A; when"01"=> F <= B; when"10"=> F <= A xor B; whenothers=>null; endcase; endprocess; ENDARCHITECTURE; 17 VHDL 360 ©
  • 20. Skills Check Do you think a Latch would be inferred in the below example? Example 7: LIBRARYieee; USEieee.std_logic_1164.all; ENTITYincomplete_assignmentIS port(sel:instd_logic_vector(1downto0); A, B :instd_logic; O1, O2:outstd_logic); ENDENTITY; ARCHITECTURE rtl OFincomplete_assignmentIS BEGIN process(sel, A, B)begin case(sel)is when"00"=> O1 <= A; O2 <= A and B; when"01"=> O1 <= B; O2 <= A xor B; when"10"=> O1 <= A xor B; when"11"=> O2 <= A or B; whenothers=> O1 <= '0'; O2 <= '0'; endcase; endprocess; ENDARCHITECTURE; 18 VHDL 360 ©
  • 21.
  • 22.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. Sequential Logic Example 11: 8-bit Shift Register (Shift right) Libraryieee; useieee.std_logic_1164.all; entity shift_register is Port( clk, D, enable :inSTD_LOGIC; Q :outSTD_LOGIC); endentity; architecture Behavioral of shift_register is begin process(clk) variable reg:std_logic_vector(7downto0); begin ifrising_edge(clk)then if enable = '1' then for i in1to7loop reg(i-1):= reg(i); endloop; reg(7):= d; endif; endif; Q <= reg(0); endprocess; end Behavioral; 7 6 5 4 3 2 1 0 VHDL 360 © 26
  • 29. Flip-Flop Inference Assignments under clock edge where the object value needs to be remembered across multiple process invocations  Flip-Flop Signal assignment under clock edge will always infer a Flip-Flop Variable assignment under clock edge will infer Flip-Flop only when its value ought to be remembered across process invocations 27 VHDL 360 ©
  • 30. Exercise 1 LIBRARYieee; USEieee.std_logic_1164.all; Entity unknown is port(x:outstd_logic; y:instd_logic_vector(3downto0); c:ininteger); Endentity; Architecture behave of unknown is Begin x <= y(c); End behave; VHDL 360 © 28 Deduce what the below code models Use synthesis tool to validate your answer
  • 31. Contacts You can contact us at: http://www.embedded-tips.blogspot.com/ VHDL 360 © 29