TUTORIAL MY FIRST HARDWARE DESIGN Tristan Gingold - - - PowerPoint PPT Presentation

tutorial my first hardware design
SMART_READER_LITE
LIVE PREVIEW

TUTORIAL MY FIRST HARDWARE DESIGN Tristan Gingold - - - PowerPoint PPT Presentation

TUTORIAL MY FIRST HARDWARE DESIGN Tristan Gingold - tgingold@free.fr - FOSDEM17 ITS A TALK ABOUT HARDWARE! Things like that There are many talks at FOSDEM about software. Try a different room ITS A TALK ABOUT CHIP DESIGN This


slide-1
SLIDE 1

TUTORIAL MY FIRST HARDWARE DESIGN

Tristan Gingold - tgingold@free.fr - FOSDEM’17

slide-2
SLIDE 2

IT’S A TALK ABOUT HARDWARE!

Things like that…

There are many talks at FOSDEM about software. Try a different room

slide-3
SLIDE 3

IT’S A TALK ABOUT CHIP DESIGN

  • This

This

This is a PCB (Printed Circuit Board) KiCad is a tool to design boards, you also need electronic knowledge

slide-4
SLIDE 4

MORE SPECIFICALLY, DIGITAL CHIPS

Analog chip

Numeric chip

See the difference ?

slide-5
SLIDE 5

DESIGNING AN IC IS COMPLEX…

Netlist Power Route Place Layout Cells X-talk Clock domains DRC Timing DFT LVS STA Masks Double patterning SCE

There aren’t many OSS tools for ASICs. qflow magic VLSI

slide-6
SLIDE 6

… AND VERY EXPENSIVE

ASML lithography machine Expect $$$ for the first chip…

slide-7
SLIDE 7

BUT SOME ARE PROGRAMMABLE!

Normal chip FPGA

There are other kinds of programmable circuits: Gate array CPLD …

slide-8
SLIDE 8

FPGA ARCHITECTURE

Programmable pad: Direction Strength Level… Programmable logic (LUT) Programmable switch box

That’s a very simple view… Most FPGAs also have PLL, memories, multipliers, or even SERDES/PCI-e blocks. See FPGA databooks

slide-9
SLIDE 9

DIGITAL IS ABOUT 0 AND 1

That’s simple ! Assuming you know about binary computation

For analog design, see gnucap or spice (There are always analog parts in a circuit)

slide-10
SLIDE 10

DIGITAL IS ABOUT LOGIC BASIC OPERATIONS

bbc.co.uk

Inputs Inputs Inputs NOT gate D = ~A OR gate Z = D | E Output AND gate D = B & C

slide-11
SLIDE 11

COMBINE THEM!

Q = A ^ B Symbol for XOR gate

wikipedia.org

slide-12
SLIDE 12

OR DO MATH (ONE BIT)

Q = A ^ B = A + B = A ~= B

wikipedia.org

A B Q 0 0 0 0 1 1 1 0 1 1 1 0

slide-13
SLIDE 13

THE ADDER

S : SUM C : CARRY

wikipedia.org

Full Adder

slide-14
SLIDE 14

MULTIPLE BIT ADDER

S = A + B

There are more efficient way to design large adders Search for Digital Logic Architecture

slide-15
SLIDE 15

IF YOU CAN ADD, YOU CAN MULTIPLY!

A3

B0

A2 A1 A0 A3

B1

A2 A1 A0 A3

B2

A2 A1 A0 A3

B3

A2 A1 A0 P0 P1 P2 P3 P4 P5 P6 P7

P = A * B

There are more efficient way to design multipliers

slide-16
SLIDE 16

YOU CAN DESIGN ANY LOGICAL/ARITH FUNCTION

F()

Inputs Outputs

Well, many functions… But this is not very efficient (can take a lot of gates)

slide-17
SLIDE 17

MORE POWERFUL: RECURSION!

F()

Inputs Outputs

In math, recursion is very powerful. In digital design, it doesn’t work directly!

slide-18
SLIDE 18

TIMING SYNCHRONISATION

wikipedia.org

Do you remember the full adder ? It takes time for a signal to propagate through gates. (due to capacities). So the arrival times at S and Cout differ.

slide-19
SLIDE 19

TIMING DIAGRAM

+1

What you expect: What you get:

Outputs are not available at the same time.

Thanks to http://wavedrom.com/editor.html

slide-20
SLIDE 20

SYNCHRONOUS DESIGN

You can try to balance paths, but:

  • It’s very hard
  • propagation time depends on too many factors

You can use a logic that is not affected by delay variation (like gray code), but:

  • works only in some cases.

Rule #1:

no direct loop/feedback

So how to do ?

slide-21
SLIDE 21

SYNCHRONOUS DESIGN

+1 clk

Flip Flop: update output on rising edge of the clock Clock

A B Clean

slide-22
SLIDE 22

DIGITAL DESIGN

It’s a mix of:

  • logic gates
  • flip flops

It is possible to use schematic editors, but

  • tedious
  • doesn’t scale well

Use an HDL Hardware Description Language I will use VHDL

There are other way to synchronise (latch, falling edge, double edge…)

slide-23
SLIDE 23

MY FIRST DESIGN BLINKING LEDS

latticesemi.com

Using OSS tools:

  • ghdl
  • yosys
  • arachne-pnr
  • iceStorm

Target: Lattice iCEstick ~ 22 euros Supported by OSS tools Leds

slide-24
SLIDE 24

VHDL: EXTERNAL INTERFACE

boilerplate Comment (to not forget leds position) Input: clock

(externally generated 3Mhz)

  • utputs: leds

interface

slide-25
SLIDE 25

INTERNALS

Internals Internal wire Process: concurrent execution, triggered on clk concurrent assignments

There are many VHDL or Verilog tutorials on the web.

slide-26
SLIDE 26

SYNTHESIS

Translating (or compiling) sources to gates (netlist) First, analysing sources: Synthesis:

  • utput file

unit name synthesis script frontend command

slide-27
SLIDE 27

PLACE & ROUTE

Allocate resources on the FPGA device input

  • utput

place file IC pin #

slide-28
SLIDE 28

PROGRAM

Write into the FPGA flash USB interface Create the binary file: Write to flash: The FPGA is automatically reset and then load the new config

slide-29
SLIDE 29

TOOLS USED

Synthesis: http://www.clifford.at/yosys/ VHDL front-end: https://github.com/tgingold/ghdlsynth-beta https://github.com/tgingold/ghdl Place and route: https://github.com/cseed/arachne-pnr iCE40 tools: http://www.clifford.at/icestorm/

slide-30
SLIDE 30

QUESTIONS ?