SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
FPGA hacking with Free Software Tools
Pramode C.E
http://pramode.net
March 12, 2016
What is this?
Pramode C.E FPGA hacking with Free Software Tools
From NAND to Tetris
Pramode C.E FPGA hacking with Free Software Tools
Can you build the Nand2Tetris CPU on real h/w without having to
wire up hundreds of gates on prototyping boards?
Pramode C.E FPGA hacking with Free Software Tools
Field Programmable Gate Arrays (FPGA's)
Pramode C.E FPGA hacking with Free Software Tools
How does an FPGA work?
Pramode C.E FPGA hacking with Free Software Tools
Programming an FPGA
Circuit is described using Verilog / VHDL
Simulated to ensure correct operation
Synthesized to a netlist
Place-and-route
Send the "bitstream" to the FPGA
Pramode C.E FPGA hacking with Free Software Tools
Programming an FPGA
Simulation can be done using purely free software tools
(example: iverilog)
Proprietary tools required for generating the "bitstream" which
will congure the FPGA.
Pramode C.E FPGA hacking with Free Software Tools
The IceStorm Project
Home Page: cliord.at/icestorm
Target: Lattice Semiconductor's ICE40 FPGA's
Main Tools: yosys (synthesis), arachne-pnr (place and
route),icepack(le format conversion),iceprog(device
programming)
Pramode C.E FPGA hacking with Free Software Tools
Hello, World!
A simple Verilog model:
module And2(input a, b, output c);
assign c = a  b;
endmodule
Pramode C.E FPGA hacking with Free Software Tools
A NAND Gate
module Nand2(output c, input a, b);
assign c = ~(a  b);
endmodule
Pramode C.E FPGA hacking with Free Software Tools
A NAND Gate - by combining modules
module Nand2(output c, input a, b);
wire f;
and G1(f, a, b);
not G2(c, f);
endmodule
Pramode C.E FPGA hacking with Free Software Tools
But where is the hardware??
The Lattice IceStick evaluation board
Pramode C.E FPGA hacking with Free Software Tools
LED On!
Put on LED1 on the IceStick board. A le with pin-mappings for
LED1,LED2 etc is needed for proper operation.
module Led(output LED1, LED2, LED3, LED4, LED5);
assign LED1 = 1;
assign LED2 = 0;
assign LED3 = 0;
assign LED4 = 0;
assign LED5 = 0;
endmodule
Pramode C.E FPGA hacking with Free Software Tools
LED On!
Here is the build script for the previous program(led.v is the verilog
source and led.pcf is the pin mapping):
yosys -p synth_ice40 -blif led.blif led.v
arachne-pnr -d 1k -p led.pcf led.blif -o led.asc
icepack led.asc led.bin
iceprog led.bin
Pramode C.E FPGA hacking with Free Software Tools
LED On!
And here is led.pcf:
set_io LED1 99 # red
set_io LED2 98 # red
set_io LED3 97 # red
set_io LED4 96 # red
set_io LED5 95 # green
Pramode C.E FPGA hacking with Free Software Tools
Concurrency and Hardware
y = (a or b) and (c or d) implemented on an FPGA:
Pramode C.E FPGA hacking with Free Software Tools
Concurrency and Hardware
y = (a or b) and (c or d) evaluated by a microprocessor(note:
output produced by gcc -S):
movl a, %edx
movl b, %eax
movl %edx, %ecx
orl %eax, %ecx
movl c, %edx
movl d, %eax
orl %edx, %eax
andl %ecx, %eax
Pramode C.E FPGA hacking with Free Software Tools
A NAND Gate - in real Hardware!
PMOD1 and PMOD2 are pins 1 and 2 on the PMOD connector
of the IceStick board.
module Nand2(input PMOD1, PMOD2,
output LED1,LED2,LED3,LED4,LED5);
// Nand gate o/p is on LED1 only
assign LED1 = ~(PMOD1  PMOD2);
assign LED2 = 0;
assign LED3 = 0;
assign LED4 = 0;
assign LED5 = 0;
endmodule
Pramode C.E FPGA hacking with Free Software Tools
WhoAmI?
module WhoAmI(input PMOD1,PMOD2,PMOD3,
output LED1,LED2,LED3,LED4,LED5);
// only LED1 is significant
wire f1,f2,f3,f4;
assign f1 = (~PMOD1)  PMOD2  (~PMOD3);
assign f2 = (~PMOD1)  PMOD2  PMOD3;
assign f3 = PMOD1  (~PMOD2)  PMOD3;
assign f4 = PMOD1  PMOD2  PMOD3;
assign LED1 = f1 | f2 | f3 | f4;
//assign LED2,3,4,5 to 0 ... lines not shown.
endmodule
Pramode C.E FPGA hacking with Free Software Tools
WhoAmI?
module WhoAmI(input PMOD1,PMOD2,PMOD3,
output LED1,LED2,LED3,LED4,LED5);
// only LED1 is significant
always @(*)
begin
if(PMOD1 == 0) LED1 = PMOD2;
else LED1 = PMOD3;
end
//assign LED2,3,4,5 to 0 ... lines not shown
endmodule
Pramode C.E FPGA hacking with Free Software Tools
WhoAmI? The Answer!!
Pramode C.E FPGA hacking with Free Software Tools
WhoAmI, again!
module WhoAmIAgain(input PMOD1,PMOD2,
output LED1,LED2,LED3,LED4,LED5);
always @(posedge PMOD1)
begin
LED1 = PMOD2;
end
assign LED2 = 0;
assign LED3 = 0;
assign LED4 = 0;
assign LED5 = 0;
endmodule
Pramode C.E FPGA hacking with Free Software Tools
WhoAmIAgain? The Answer!!
Pramode C.E FPGA hacking with Free Software Tools
More demos!
Rotating LED's
Random bit generation using a Linear Feedback Shift Register
A UART transmitter
A full CPU running a FORTH system!
Pramode C.E FPGA hacking with Free Software Tools
Random bitstream using an LFSR
Pramode C.E FPGA hacking with Free Software Tools
A UART Transmitter
Pramode C.E FPGA hacking with Free Software Tools
Some other languages/frameworks available for hardware
description
MyHDL - uses Python
Chisel - uses Scala
Clash - uses Haskell
HardCaml - uses Ocaml
PSHDL - a beginner level tool which generates VHDL
IceStudio - Verilog code from block diagrams!
Pramode C.E FPGA hacking with Free Software Tools
The Future
The IcoBoard
Pramode C.E FPGA hacking with Free Software Tools
The Future
The IceZum
Pramode C.E FPGA hacking with Free Software Tools
The Future
Check out icoboard.org for more exciting news!
Pramode C.E FPGA hacking with Free Software Tools
Thank You! Questions welcome!
Pramode C.E FPGA hacking with Free Software Tools

Contenu connexe

Tendances

L12 programmable+logic+devices+(pld)
L12 programmable+logic+devices+(pld)L12 programmable+logic+devices+(pld)
L12 programmable+logic+devices+(pld)
NAGASAI547
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devices
Ammara Javed
 
Advance hdl design training on xilinx fpga
Advance hdl design training on xilinx fpgaAdvance hdl design training on xilinx fpga
Advance hdl design training on xilinx fpga
demon_2M
 
programmable_devices_en_02_2014
programmable_devices_en_02_2014programmable_devices_en_02_2014
programmable_devices_en_02_2014
Svetozar Jovanovic
 

Tendances (20)

Fundamentals of FPGA
Fundamentals of FPGAFundamentals of FPGA
Fundamentals of FPGA
 
L12 programmable+logic+devices+(pld)
L12 programmable+logic+devices+(pld)L12 programmable+logic+devices+(pld)
L12 programmable+logic+devices+(pld)
 
Introduction to FPGAs
Introduction to FPGAsIntroduction to FPGAs
Introduction to FPGAs
 
Programmable Logic Devices Plds
Programmable Logic Devices PldsProgrammable Logic Devices Plds
Programmable Logic Devices Plds
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devices
 
What is FPGA?
What is FPGA?What is FPGA?
What is FPGA?
 
Reconfigurable ICs
Reconfigurable ICsReconfigurable ICs
Reconfigurable ICs
 
Cpld fpga
Cpld fpgaCpld fpga
Cpld fpga
 
FPGA in outer space
FPGA in outer spaceFPGA in outer space
FPGA in outer space
 
Field Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and InterconnectionsField Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and Interconnections
 
FPGA Overview
FPGA OverviewFPGA Overview
FPGA Overview
 
Cpld and fpga mod vi
Cpld and fpga   mod viCpld and fpga   mod vi
Cpld and fpga mod vi
 
#EEE - Field programmable gate array
#EEE - Field programmable gate array#EEE - Field programmable gate array
#EEE - Field programmable gate array
 
Advance hdl design training on xilinx fpga
Advance hdl design training on xilinx fpgaAdvance hdl design training on xilinx fpga
Advance hdl design training on xilinx fpga
 
Fpga architectures and applications
Fpga architectures and applicationsFpga architectures and applications
Fpga architectures and applications
 
Programmable logic device (PLD)
Programmable logic device (PLD)Programmable logic device (PLD)
Programmable logic device (PLD)
 
programmable_devices_en_02_2014
programmable_devices_en_02_2014programmable_devices_en_02_2014
programmable_devices_en_02_2014
 
Field-programmable gate array
Field-programmable gate arrayField-programmable gate array
Field-programmable gate array
 
Flash memory
Flash memoryFlash memory
Flash memory
 
Fpga Knowledge
Fpga KnowledgeFpga Knowledge
Fpga Knowledge
 

En vedette

ソフトウェア技術者はFPGAをどのように使うか
ソフトウェア技術者はFPGAをどのように使うかソフトウェア技術者はFPGAをどのように使うか
ソフトウェア技術者はFPGAをどのように使うか
なおき きしだ
 
FPGAのトレンドをまとめてみた
FPGAのトレンドをまとめてみたFPGAのトレンドをまとめてみた
FPGAのトレンドをまとめてみた
Takefumi MIYOSHI
 

En vedette (10)

Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017
 
FPGA Community
FPGA CommunityFPGA Community
FPGA Community
 
Rust Programming Language
Rust Programming LanguageRust Programming Language
Rust Programming Language
 
FPGAことはじめ
FPGAことはじめFPGAことはじめ
FPGAことはじめ
 
ソフトウェア技術者はFPGAをどのように使うか
ソフトウェア技術者はFPGAをどのように使うかソフトウェア技術者はFPGAをどのように使うか
ソフトウェア技術者はFPGAをどのように使うか
 
$30で始めるFPGA
$30で始めるFPGA$30で始めるFPGA
$30で始めるFPGA
 
増え続ける情報に対応するためのFPGA基礎知識
増え続ける情報に対応するためのFPGA基礎知識増え続ける情報に対応するためのFPGA基礎知識
増え続ける情報に対応するためのFPGA基礎知識
 
FPGAのトレンドをまとめてみた
FPGAのトレンドをまとめてみたFPGAのトレンドをまとめてみた
FPGAのトレンドをまとめてみた
 
HPCで使えそうなFPGA搭載AWS F1 インスタンス_20161218
HPCで使えそうなFPGA搭載AWS F1 インスタンス_20161218HPCで使えそうなFPGA搭載AWS F1 インスタンス_20161218
HPCで使えそうなFPGA搭載AWS F1 インスタンス_20161218
 
FPGA・リコンフィギャラブルシステム研究の最新動向
FPGA・リコンフィギャラブルシステム研究の最新動向FPGA・リコンフィギャラブルシステム研究の最新動向
FPGA・リコンフィギャラブルシステム研究の最新動向
 

Similaire à Fpga

Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
Tom Paulus
 

Similaire à Fpga (20)

Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
 
Raspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentRaspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application Development
 
Raspberry pi-spectrum-analyzer-display-on-rgb-led-strip
Raspberry pi-spectrum-analyzer-display-on-rgb-led-stripRaspberry pi-spectrum-analyzer-display-on-rgb-led-strip
Raspberry pi-spectrum-analyzer-display-on-rgb-led-strip
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Interacting with Intel Edison
Interacting with Intel EdisonInteracting with Intel Edison
Interacting with Intel Edison
 
Attendance system using MYSQL with Raspberry pi and RFID-RC522
Attendance system using MYSQL with Raspberry pi and RFID-RC522Attendance system using MYSQL with Raspberry pi and RFID-RC522
Attendance system using MYSQL with Raspberry pi and RFID-RC522
 
Controlling the internet of things using wearable tech - Design+Code Day; Ara...
Controlling the internet of things using wearable tech - Design+Code Day; Ara...Controlling the internet of things using wearable tech - Design+Code Day; Ara...
Controlling the internet of things using wearable tech - Design+Code Day; Ara...
 
Lab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdfLab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdf
 
Physical Computing with the Arduino platform and Ruby
Physical Computing with the Arduino platform and RubyPhysical Computing with the Arduino platform and Ruby
Physical Computing with the Arduino platform and Ruby
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
programmable logic array
programmable logic arrayprogrammable logic array
programmable logic array
 
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdfSKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
 
Johnny-Five
Johnny-FiveJohnny-Five
Johnny-Five
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kit
 
Wireless Temperature Measurement with LabVIEW and Spartan3E
Wireless Temperature Measurement with LabVIEW and Spartan3EWireless Temperature Measurement with LabVIEW and Spartan3E
Wireless Temperature Measurement with LabVIEW and Spartan3E
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Fpga

  • 1. FPGA hacking with Free Software Tools Pramode C.E http://pramode.net March 12, 2016
  • 2. What is this? Pramode C.E FPGA hacking with Free Software Tools
  • 3. From NAND to Tetris Pramode C.E FPGA hacking with Free Software Tools
  • 4. Can you build the Nand2Tetris CPU on real h/w without having to wire up hundreds of gates on prototyping boards? Pramode C.E FPGA hacking with Free Software Tools
  • 5. Field Programmable Gate Arrays (FPGA's) Pramode C.E FPGA hacking with Free Software Tools
  • 6. How does an FPGA work? Pramode C.E FPGA hacking with Free Software Tools
  • 7. Programming an FPGA Circuit is described using Verilog / VHDL Simulated to ensure correct operation Synthesized to a netlist Place-and-route Send the "bitstream" to the FPGA Pramode C.E FPGA hacking with Free Software Tools
  • 8. Programming an FPGA Simulation can be done using purely free software tools (example: iverilog) Proprietary tools required for generating the "bitstream" which will congure the FPGA. Pramode C.E FPGA hacking with Free Software Tools
  • 9. The IceStorm Project Home Page: cliord.at/icestorm Target: Lattice Semiconductor's ICE40 FPGA's Main Tools: yosys (synthesis), arachne-pnr (place and route),icepack(le format conversion),iceprog(device programming) Pramode C.E FPGA hacking with Free Software Tools
  • 10. Hello, World! A simple Verilog model: module And2(input a, b, output c); assign c = a b; endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 11. A NAND Gate module Nand2(output c, input a, b); assign c = ~(a b); endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 12. A NAND Gate - by combining modules module Nand2(output c, input a, b); wire f; and G1(f, a, b); not G2(c, f); endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 13. But where is the hardware?? The Lattice IceStick evaluation board Pramode C.E FPGA hacking with Free Software Tools
  • 14. LED On! Put on LED1 on the IceStick board. A le with pin-mappings for LED1,LED2 etc is needed for proper operation. module Led(output LED1, LED2, LED3, LED4, LED5); assign LED1 = 1; assign LED2 = 0; assign LED3 = 0; assign LED4 = 0; assign LED5 = 0; endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 15. LED On! Here is the build script for the previous program(led.v is the verilog source and led.pcf is the pin mapping): yosys -p synth_ice40 -blif led.blif led.v arachne-pnr -d 1k -p led.pcf led.blif -o led.asc icepack led.asc led.bin iceprog led.bin Pramode C.E FPGA hacking with Free Software Tools
  • 16. LED On! And here is led.pcf: set_io LED1 99 # red set_io LED2 98 # red set_io LED3 97 # red set_io LED4 96 # red set_io LED5 95 # green Pramode C.E FPGA hacking with Free Software Tools
  • 17. Concurrency and Hardware y = (a or b) and (c or d) implemented on an FPGA: Pramode C.E FPGA hacking with Free Software Tools
  • 18. Concurrency and Hardware y = (a or b) and (c or d) evaluated by a microprocessor(note: output produced by gcc -S): movl a, %edx movl b, %eax movl %edx, %ecx orl %eax, %ecx movl c, %edx movl d, %eax orl %edx, %eax andl %ecx, %eax Pramode C.E FPGA hacking with Free Software Tools
  • 19. A NAND Gate - in real Hardware! PMOD1 and PMOD2 are pins 1 and 2 on the PMOD connector of the IceStick board. module Nand2(input PMOD1, PMOD2, output LED1,LED2,LED3,LED4,LED5); // Nand gate o/p is on LED1 only assign LED1 = ~(PMOD1 PMOD2); assign LED2 = 0; assign LED3 = 0; assign LED4 = 0; assign LED5 = 0; endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 20. WhoAmI? module WhoAmI(input PMOD1,PMOD2,PMOD3, output LED1,LED2,LED3,LED4,LED5); // only LED1 is significant wire f1,f2,f3,f4; assign f1 = (~PMOD1) PMOD2 (~PMOD3); assign f2 = (~PMOD1) PMOD2 PMOD3; assign f3 = PMOD1 (~PMOD2) PMOD3; assign f4 = PMOD1 PMOD2 PMOD3; assign LED1 = f1 | f2 | f3 | f4; //assign LED2,3,4,5 to 0 ... lines not shown. endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 21. WhoAmI? module WhoAmI(input PMOD1,PMOD2,PMOD3, output LED1,LED2,LED3,LED4,LED5); // only LED1 is significant always @(*) begin if(PMOD1 == 0) LED1 = PMOD2; else LED1 = PMOD3; end //assign LED2,3,4,5 to 0 ... lines not shown endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 22. WhoAmI? The Answer!! Pramode C.E FPGA hacking with Free Software Tools
  • 23. WhoAmI, again! module WhoAmIAgain(input PMOD1,PMOD2, output LED1,LED2,LED3,LED4,LED5); always @(posedge PMOD1) begin LED1 = PMOD2; end assign LED2 = 0; assign LED3 = 0; assign LED4 = 0; assign LED5 = 0; endmodule Pramode C.E FPGA hacking with Free Software Tools
  • 24. WhoAmIAgain? The Answer!! Pramode C.E FPGA hacking with Free Software Tools
  • 25. More demos! Rotating LED's Random bit generation using a Linear Feedback Shift Register A UART transmitter A full CPU running a FORTH system! Pramode C.E FPGA hacking with Free Software Tools
  • 26. Random bitstream using an LFSR Pramode C.E FPGA hacking with Free Software Tools
  • 27. A UART Transmitter Pramode C.E FPGA hacking with Free Software Tools
  • 28. Some other languages/frameworks available for hardware description MyHDL - uses Python Chisel - uses Scala Clash - uses Haskell HardCaml - uses Ocaml PSHDL - a beginner level tool which generates VHDL IceStudio - Verilog code from block diagrams! Pramode C.E FPGA hacking with Free Software Tools
  • 29. The Future The IcoBoard Pramode C.E FPGA hacking with Free Software Tools
  • 30. The Future The IceZum Pramode C.E FPGA hacking with Free Software Tools
  • 31. The Future Check out icoboard.org for more exciting news! Pramode C.E FPGA hacking with Free Software Tools
  • 32. Thank You! Questions welcome! Pramode C.E FPGA hacking with Free Software Tools