SlideShare a Scribd company logo
1 of 48
Download to read offline
21.05.2014 1
FPGA Design with
Python and MyHDL
Guy Eschemann
21.05.2014 2
Content
• About us
• A short introduction to Python
• Introduction to MyHDL
• Demo
• Questions
21.05.2014 3
About noasic
• Quick Facts
– Founded in 2014
– 14+ years experience in FPGA design
– Located in Kehl, Germany
• Areas of expertise
– FPGA & IP core design and verification
– VHDL code generators
21.05.2014 4
VHDL Code Generators (1)
21.05.2014 5
VHDL Code Generators (2)
21.05.2014 6
21.05.2014 7
A short introduction to
21.05.2014 8
Python
• Created 1991 by Guido van
Rossum at CWI (Netherlands)
• General-purpose, high-level
programming language
• Emphasizes code readability
• Write less code
• Strongly, dynamically typed
• Object-oriented
• Open-source
• Runs on many platforms
21.05.2014 9
Sample Python code
21.05.2014 10
Python – Syntax
• Blocks are specified by indentation
• No mandatory statement termination
• Comments start with #
• Assign values using =
• Test equality using ==
• Increment/decrement using += or -=
21.05.2014 11
Python – Data Structures
• Lists
– like one-dimensional arrays
• Tuples
– immutable, one-dimensional arrays
• Dictionaries
– associative arrays („hash tables“)
21.05.2014 12
Python – Strings
• Can use either single or double quotation
marks
• Multi-line strings enclosed in triple quotes
• Use modulo (%) operator and a tuple to
format a string
21.05.2014 13
Python – Flow Control
• Flow control statements:
– if
– for
– while
– there is no case/switch. Use „if“ instead.
21.05.2014 14
Python – Functions
• Declared with the „def“ keyword
• Optional parameters supported
• Functions can return multiple values
21.05.2014 15
Python – Importing
• External libaries (such as MyHDL) must be
imported before they can be used:
from myhdl import intbv
OR
from myhdl import *
21.05.2014 16
Python Libraries
• String handling
• Regular expressions
• Random number generation
• Unit-test framework
• OS interfacing
• GUI development
• Modules for math, database connections,
network interfacing etc.
• Hardware design (MyHDL)
21.05.2014 17
Introduction to
21.05.2014 18
MyHDL
• Python-based hardware
description language
• Created 2003 by Jan
Decaluwe
• Open source
21.05.2014 19
Why MyHDL?
• Write less code
• Avoid common VHDL and Verilog pitfalls
• Apply modern SW development techniques to
HW design
• Can generate both VHDL and Verilog
• Simulator included
• Open source
• Runs on many platforms (Windows, OSX, Linux)
• Python ecosystem
21.05.2014 20
What MyHDL is not
• Not a way to turn arbitrary Python into
silicon
• Not a radically new approach
• Not a synthesis tool
• Not an IP block library
• Not only for implementation
• Not well suited for accurate timing
simulations
21.05.2014 21
MyHDL Design Flow
21.05.2014 22
Example – 8 bit counter
21.05.2014 23
Modeling Components
• Components are modeled using functions
• Function parameters map to ports
21.05.2014 24
Modeling Processes
• Processes are modeled using special
„generator“ functions
• Decorators are used to create generator
functions
21.05.2014 25
The @instance decorator
• Most general, creates generator from a
generator function
a 1
0b
z
21.05.2014 26
The @always decorator
• Abstracts an outer „while True“ loop followed
by a „yield“ statement
a 1
0b
z
21.05.2014 27
Combinational logic: @always_comb
• Automatically infers the sensitivity list
a 1
0b
z
21.05.2014 28
Sequential logic: @always_seq
• Infers the reset functionality
• Equivalent code:
21.05.2014 29
Function Decorators
• @instance: most general, multiple yields
• @always: single yield, abstracts „while
True“ loop
• @always_comb: for asynchronous logic,
automatically infers sensitivity list
• @always_seq: for sequential logic,
automatically infers the reset functionality
21.05.2014 30
MyHDL Signals
• Similar to VHDL signals
• Signal declaration:
s_empty = Signal(0)
s_count = Signal(intbv(0)[8:])
s_clk = Signal(bool(0))
• Signal assignment:
s_count.next = 0
21.05.2014 31
MyHDL intbv class
• Similiar to standard Python „int“ type with
added indexing and slicing capabilities
• intbv = „integer with bit-vector flavor“
• Provides access to underlying two‘s
complement representation
• Range of allowed values can be
constrained
21.05.2014 32
MyHDL intbv creation
Create an intbv:
intbv([val=None] [, min=None] [, max=None])
Example:
>>> a = intbv(24, min=0, max=25)
>>> a.min
0
>>> a.max
25
>>> len(a)
5
21.05.2014 33
MyHDL intbv indexing and slicing
Indexing:
>>> a = intbv(0x12)
>>> bin(a)
'10010'
>>> a[0]
False
>>> a[1]
True
Slicing:
>>> a = intbv(0x12)
>>> a[4:0]
intbv(2L)
21.05.2014 34
MyHDL intbv creation
Create an intbv, specifying its width:
>>> a = intbv(24)[5:]
>>> a.min
0
>>> a.max
32
>>> len(a)
5
21.05.2014 35
Modeling hierarchy
21.05.2014 36
Generated VHDL code
21.05.2014 37
Verification
• Verification is MyHDL´s strongest point
• Arguably the hardest part of hardware
design
• There are no restrictions for verification:
can use the full power of Python
• Can do „agile“ hardware design
• The Foundation is an event-driven
simulator in the MyHDL library
21.05.2014 38
MyHDL Simulator
21.05.2014 39
A basic MyHDL simulation
21.05.2014 40
Debugging in MyHDL
• Regular Python debugging
• Waveform viewer output
21.05.2014 41
Conversion
• A subset of MyHDL can be automatically
converted to VHDL and Verilog
• The converter maintains the abstraction
level
• Supports some unique MyHDL features
• Creates readable VHDL/Verilog
• Convertible subset much broader than
synthesizable subset
21.05.2014 42
Conversion example
• MyHDL Code
• Conversion to Verilog
• Conversion to VHDL
• The converter does the casts and resizings
automatically
21.05.2014 43
User-defined code
21.05.2014 44
Demo
21.05.2014 45
Caveats
• Dynamic nature of Python needs some
getting used to
• Error messages can be cryptic
• Cannot import legacy VHDL/Verilog code
– Write own behaviorals models for simulation
– Use user-defined code for conversion
• Cannot generate parameterizable HDL
code
21.05.2014 46
MyHDL future
• Fixed-point support in the converter
• Interfaces
• Python 3.0 support
21.05.2014 47
Resources
• http://python.org
• http://myhdl.org
– Manual & examples
– Download & installation instructions
– Mailing list
– Tutorials & publications
• @MyHDL on twitter
• Development with mercurial on Bitbucket
21.05.2014 48
Contact
Guy Eschemann
noasic GmbH
Sundheimer Feld 6
77694 Kehl
guy@noasic.com
http://noasic.com
Twitter: @geschema

More Related Content

What's hot

Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
Kelly Bresnahan
 

What's hot (20)

VHdl lab report
VHdl lab reportVHdl lab report
VHdl lab report
 
AES Encryption
AES EncryptionAES Encryption
AES Encryption
 
Diffiehellman
DiffiehellmanDiffiehellman
Diffiehellman
 
AES.ppt
AES.pptAES.ppt
AES.ppt
 
Understanding Reed-Solomon code
Understanding Reed-Solomon codeUnderstanding Reed-Solomon code
Understanding Reed-Solomon code
 
Symmetric encryption
Symmetric encryptionSymmetric encryption
Symmetric encryption
 
Cryptography
CryptographyCryptography
Cryptography
 
sc vector
sc vectorsc vector
sc vector
 
1524 elliptic curve cryptography
1524 elliptic curve cryptography1524 elliptic curve cryptography
1524 elliptic curve cryptography
 
IIR Filter Design for De Nosing Speech Signal using Matlab
IIR Filter Design for De Nosing Speech Signal using MatlabIIR Filter Design for De Nosing Speech Signal using Matlab
IIR Filter Design for De Nosing Speech Signal using Matlab
 
Aes
AesAes
Aes
 
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardComputer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
 
3. The Data Encryption Standard (DES) and Alternatives
3. The Data Encryption Standard (DES) and Alternatives3. The Data Encryption Standard (DES) and Alternatives
3. The Data Encryption Standard (DES) and Alternatives
 
Lzw algorithm
Lzw algorithmLzw algorithm
Lzw algorithm
 
Mediated+authentication
Mediated+authenticationMediated+authentication
Mediated+authentication
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 
Elliptic Curve Cryptography for those who are afraid of maths
Elliptic Curve Cryptography for those who are afraid of mathsElliptic Curve Cryptography for those who are afraid of maths
Elliptic Curve Cryptography for those who are afraid of maths
 
Enkripsi RC4
Enkripsi RC4Enkripsi RC4
Enkripsi RC4
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Reed Soloman and convolution codes
Reed Soloman and convolution codesReed Soloman and convolution codes
Reed Soloman and convolution codes
 

Viewers also liked

Viewers also liked (12)

Building ADAS system from scratch
Building ADAS system from scratchBuilding ADAS system from scratch
Building ADAS system from scratch
 
Configuring the communication on FlexRay: the case of the static segment
Configuring the communication on FlexRay: the case of the static segmentConfiguring the communication on FlexRay: the case of the static segment
Configuring the communication on FlexRay: the case of the static segment
 
RTL Presentation by Pr. John Connor
RTL Presentation by Pr. John ConnorRTL Presentation by Pr. John Connor
RTL Presentation by Pr. John Connor
 
Advanced Driver Assistance System using FPGA
Advanced Driver Assistance System using FPGAAdvanced Driver Assistance System using FPGA
Advanced Driver Assistance System using FPGA
 
Altera Cyclone IV FPGA Customer Presentation
Altera Cyclone IV FPGA Customer PresentationAltera Cyclone IV FPGA Customer Presentation
Altera Cyclone IV FPGA Customer Presentation
 
FlexRay
FlexRayFlexRay
FlexRay
 
The flex ray protocol
The flex ray protocolThe flex ray protocol
The flex ray protocol
 
flexray technology in modern cars
flexray technology in modern carsflexray technology in modern cars
flexray technology in modern cars
 
Flexray
FlexrayFlexray
Flexray
 
20 Inspiring Quotes From William Zinsser's "On Writing Well"
20 Inspiring Quotes From William Zinsser's "On Writing Well"20 Inspiring Quotes From William Zinsser's "On Writing Well"
20 Inspiring Quotes From William Zinsser's "On Writing Well"
 
Crevativty & innovation ppt mba
Crevativty & innovation ppt  mbaCrevativty & innovation ppt  mba
Crevativty & innovation ppt mba
 
The Best Startup Investor Pitch Deck & How to Present to Angels & Venture Cap...
The Best Startup Investor Pitch Deck & How to Present to Angels & Venture Cap...The Best Startup Investor Pitch Deck & How to Present to Angels & Venture Cap...
The Best Startup Investor Pitch Deck & How to Present to Angels & Venture Cap...
 

Similar to FPGA Design with Python and MyHDL

Wintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class LibraryWintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class Library
Jeremy Likness
 
Workshop: HCL Notes 14 Upgrades einfach gemacht – von A bis Z
Workshop: HCL Notes 14 Upgrades einfach gemacht – von A bis ZWorkshop: HCL Notes 14 Upgrades einfach gemacht – von A bis Z
Workshop: HCL Notes 14 Upgrades einfach gemacht – von A bis Z
panagenda
 

Similar to FPGA Design with Python and MyHDL (20)

CHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshopCHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshop
 
PHP Unconference Continuous Integration
PHP Unconference Continuous IntegrationPHP Unconference Continuous Integration
PHP Unconference Continuous Integration
 
DevOps and the C64: what's your excuse
DevOps and the C64: what's your excuseDevOps and the C64: what's your excuse
DevOps and the C64: what's your excuse
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1
 
Digital design lect 26 27
Digital design lect 26 27Digital design lect 26 27
Digital design lect 26 27
 
Code PaLOUsa Azure IoT Workshop
Code PaLOUsa Azure IoT WorkshopCode PaLOUsa Azure IoT Workshop
Code PaLOUsa Azure IoT Workshop
 
Wintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class LibraryWintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class Library
 
"Using the OpenCL C Kernel Language for Embedded Vision Processors," a Presen...
"Using the OpenCL C Kernel Language for Embedded Vision Processors," a Presen..."Using the OpenCL C Kernel Language for Embedded Vision Processors," a Presen...
"Using the OpenCL C Kernel Language for Embedded Vision Processors," a Presen...
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
 
IoT Workshop Indianapolis
IoT Workshop IndianapolisIoT Workshop Indianapolis
IoT Workshop Indianapolis
 
Workshop: HCL Notes 14 Upgrades einfach gemacht – von A bis Z
Workshop: HCL Notes 14 Upgrades einfach gemacht – von A bis ZWorkshop: HCL Notes 14 Upgrades einfach gemacht – von A bis Z
Workshop: HCL Notes 14 Upgrades einfach gemacht – von A bis Z
 
KiZAN IoT Workshop - Memphis
KiZAN IoT Workshop - MemphisKiZAN IoT Workshop - Memphis
KiZAN IoT Workshop - Memphis
 
IoT Workshop - Waukesha
IoT Workshop - WaukeshaIoT Workshop - Waukesha
IoT Workshop - Waukesha
 
IoT Workshop Chicago
IoT Workshop ChicagoIoT Workshop Chicago
IoT Workshop Chicago
 
Mini .net conf 2020
Mini .net conf 2020Mini .net conf 2020
Mini .net conf 2020
 
RSA SF Conference talk-2009-ht2-401 sallam
RSA SF Conference talk-2009-ht2-401 sallamRSA SF Conference talk-2009-ht2-401 sallam
RSA SF Conference talk-2009-ht2-401 sallam
 
IoT Workshop Cincinnati
IoT Workshop CincinnatiIoT Workshop Cincinnati
IoT Workshop Cincinnati
 
Codasip application class RISC-V processor solutions
Codasip application class RISC-V processor solutionsCodasip application class RISC-V processor solutions
Codasip application class RISC-V processor solutions
 
Summit 16: NetIDE: Integrating and Orchestrating SDN Controllers
Summit 16: NetIDE: Integrating and Orchestrating SDN ControllersSummit 16: NetIDE: Integrating and Orchestrating SDN Controllers
Summit 16: NetIDE: Integrating and Orchestrating SDN Controllers
 
DevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile GamesDevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile Games
 

Recently uploaded

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Recently uploaded (20)

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 

FPGA Design with Python and MyHDL