43
Languages for Meta-Programmable Logic and SDR Techniques for Quantum Information Sébastien Bourdeauducq, Robert Jördens M-Labs Ltd – https://m-labs.hk August 20, 2017 David Ilif, CC-BY-SA

LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Languages for Meta-Programmable Logic andSDR Techniques for Quantum Information

Sébastien Bourdeauducq, Robert Jördens

M-Labs Ltd – https://m-labs.hk

August 20, 2017

David Ilif, CC-BY-SA

Page 2: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

M-Labs Limited

• Founded after Milkymist, similar to a small research institute• Engineering contracts for physics are fun:

• Purpose• Challenging problems, multidisciplinary, advanced technology• Often open source friendly

• Incorporated in Hong Kong in 2013, now several full-time staf

Page 3: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

History of Migen

• Built Milkymist SoC in Verilog (2007-2011)• Datalow graphics pipeline, hardcoded• Wanted a language for hardware datalow• Tried to implement on top of MyHDL, failed (2011)• Developed Migen FHDL, based on metaprogramming• Started implementing again on top of Migen FHDL• Found out it was excellent for SoC, started MiSoC (2012)• Migen datalow is not used much these days

Page 4: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Migen’s basic idea: metaprogramming

• Use high level language (Python) to build code in low levellanguage (HDL).

• Migen gives you Python objects to assemble to build yourdesign.

• Contains hacks for syntactic sugar.• Those objects assembled by your Python program are

converted to Verilog so that third-party tools can synthesizethe design.

• Helps with FSMs, busses, interconnect, portability,simulations, and more.

Page 5: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

A simple design

a = Signal()b = Signal()x = Signal()y = Signal()module.comb += x.eq(a | b)module.comb += _Assign(y, _Operator("+", [a, b]))verilog.convert(module)

Page 6: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

A simple design

module top();

reg a = 1'd0;reg b = 1'd0;wire x;wire y;

assign x = (a | b);assign y = (a | b);

endmodule

Page 7: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

MiSoC

• Provides high level classes for bus interconnect and MMIO:• Wishbone• Coniguration and status registers• streaming (ex-datalow) interfaces

• Provides many cores:• Processors (wrapped Verilog): LM32, mor1kx (a better

OpenRISC)• SDRAM controllers and PHYs (SDR, DDR1-3, fastest open

source DDR3 controller @64Gbps)• UART, timer, SPI, 10/100/1000 Ethernet• VGA/DVI/HDMI framebufer, DVI/HDMI sampler

Page 8: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

MiSoC

• Provides bare-metal software (bootloader, low-level libraries)for your SoC.

• Provides SoC integration template classes.• Provides basic and extensible SoC ports to FPGA boards.• If those do not it you, you can import the cores only and

integrate yourself.

Page 9: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

LTE base station• PCIe x1 generic SDR board (Artix7 with AD9361: 70MHz to

6GHz)• Almost 100% Migen/MiSoC code (the only exception is the

PCIe transceiver wrapper)• Designed to be coupled together for MIMO 4x4• With software LTE stack: allows afordable LTE BaseStation

(10x cheaper than traditionnal solutions)• > 50 boards already produced.

Page 10: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

LTE base station

A few beneits of using Migen/MiSoC:• Increased productivity compared with VHDL/Verilog.• Developing a PCIe core would have been too expensive with

traditional solutions, it has been done as part of this project.• C header iles that describes the hardware

(registers/lags/interrupts) automatically generated.• Kintex-7 KC705 prototyping board and Artix inal board share

most of the code.

Page 11: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

SATA 1.5/3/6G core

• Connect hard drives to FPGAs, 6Gbps per drive.• Used in research project at University of Hong Kong.• Kintex-7 FPGA (KC705).• All Migen, including transceiver block instantiation.

HDD picture by Evan-Amos, CC BY-SA 3.0

Page 12: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

HDMI2USB project• HDMI2USB: Open video capture hardware + irmware• Created by the TimVideos project to enable every user group

and conference to record and livestream• Based around making hardware problems, software problems

using FPGAs.• Appears as a UVC webcam and CDC ACM serial port,

allowing capture and control.• Successfully used to stream linux.conf.au!

Page 13: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Conversion from VHDL/Verilog Firmware to Migen/MiSoC

Original irmware was hand coded mix of VHDL and Verilog.• Had questionable license as used Xilinx Coregen for parts.• Slow progress, took 2 years of development.• Poor testing.

Page 14: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Conversion from VHDL/Verilog Firmware to Migen/MiSoCNew Migen+MiSoC irmware was much easier to use!

• Took about 4 weeks to re-implement everything apart fromMJPEG core.

• Unambigious, full FOSS licensing!• VHDL/Verilog are very hard to use, Python is signiicantly

faster to develop in. Softcore approach means much of code isC now.

• Already signiicantly more functionality then original irmware(Ethernet, Bufering, Multi-board support).

Page 15: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

ARTIQ

• ARTIQ is the Advanced Real-Time Infrastructure forQuantum physics.

• An integrated software/gateware/hardware system thatcontrols many aspects of atomic physics experiments.

• Initially developed with the NIST Ion Storage Group, nowwith many labs.

• Managing/scheduling experiments, driving distributed devices,displaying/archiving results.

• Timing is important.

Page 16: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

The ARTIQ-Python language

trigger.sync() # wait for trigger inputstart = now_mu() # capture trigger timefor i in range(3):

delay(5*us)dds.pulse(900*MHz, 7*us) # first pulse 5 µs after trigger

# re-reference time-lineat_mu(start + seconds_to_mu(1*ms))dds.pulse(200*MHz, 11*us) # exactly 1 ms after trigger

• A subset of Python + timing• Executed on a CPU embedded on a FPGA (the core device)• Exact time is kept in an internal variable• That variable only loosely tracks the execution time of CPU instructions• The value of that variable is exchanged with the RTIO fabric that does

precise timing• All gateware using Migen/MiSoC

Page 17: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Convenient syntax additions

with sequential:with parallel:

a.pulse(100*MHz, 10*us)b.pulse(200*MHz, 20*us)

with parallel:c.pulse(300*MHz, 30*us)d.pulse(400*MHz, 20*us)

• Experiments are inherently parallel: simultaneous laser pulses, parallelcooling of ions in diferent trap zones

• parallel and sequential contexts with arbitrary nesting• a and b pulses both start at the same time• c and d pulses both start when a and b are both done (after 20 µs)

Page 18: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Invite organizing experiment components and code reuse

class Experiment:def build(self):

self.ion1 = Ion(...)self.ion2 = Ion(...)self.transporter = Transporter(...)

@kerneldef run(self):

with parallel:self.ion1.cool(duration=10*us)self.ion2.cool(frequency=...)

self.transporter.move(speed=...)delay(100*ms)self.ion1.detect(duration=...)

Page 19: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Kernel deployment to the core device

• The Python AST is converted to LLVM IR• The LLVM IR is compiled to OpenRISC machine code• The OpenRISC binary is sent to the core device• The runtime in the core device links and runs the kernel• The kernel calls the runtime for communication (e.g. sending

back results) and interfacing with core device peripherals(RTIO, DDS, SAWG)

Page 20: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,
Page 21: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Languages for Meta-Programmable Logic and SDRTechniques for Quantum Information

Robert Jördens Sébastien Bourdeauducq

QUARTIQ and M-Labshttps://m-labs.hkhttps://quartiq.de

WISTA Management GmbH

Page 22: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Ion trap (NIST John Jost)

RF

RF

DC

DC

RF

RF

RF ground

RF ground

Page 23: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Quantum gate sequences (NIST)

Page 24: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

FPGA

ion trap

10 attenuators

50 DAC

20 DDS

50 GPIO

10 motors

10 power supplies

10 lasers

Page 25: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

FPGA

ion trap

∼10 attenuators

∼50 DAC

∼20 DDS

∼50 GPIO

∼10 motors

∼10 power supplies

∼10 lasers

Page 26: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Making pulses for Quantum Information: Phaser

• Smart Arbitrary Waveform Generator (SAWG) gateware for Sayma• Multiple Digitally Controlled Oscillators per channel• Interpolating in phase, amplitude, and frequency using B-Splines• Orders of magnitude data reduction through parametrization• GS/s data rate, interpolating up to 2.4 GS/s sample rate• Sample-accurate event timing

Page 27: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

SAWG

HBF interpolator32-tap parallel FIRs

z

HBF interpolator32-tap parallel FIRs

x

y

interpolatingaccumulator

z

x

accumulator

cubic splineinterpolator

RTIO port

CORDIClinearspline

RTIO port

RTIO port

freq

phase

xy

z

x

accumulator

cubic splineinterpolator

RTIO port

linearspline

RTIO port

RTIO port

freq

phase

xy

cubic splineinterpolator

RTIO port

linearspline

RTIO port

RTIO port

freq

phase

parallel

CORDICs

limiting

adder

limiting

adderCORDIC

limiting

adder

limiting

adder

limiting

adder

limiting

adder

x

y neighborxchg

DAC

Page 28: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

SAWG

• Two baseband DDS tones• Up-converted by parallel array of DUCs (not enabled here)• Cubic spline amplitude shaping• Absolute phase control

Page 29: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Sayma AMC Front

• Advanced Mezzanine Carrier (AMC)• Kintex Ultrascale, DDR3 RAM• SFP+, FMC, SATA, µTCA backplane• 16 Multi-Gigabit transciever pairs to RTM

Page 30: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Sayma RTM Front

• Rear Transition Module (RTM)• 2x 4 channel, 16 bit, 2.4 GS/s, JESD204B DACs• 2x 4 channel, 16 bit, 125 MS/s, JESD204B ADCs

Page 31: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Sayma RTM Back

• Ultra low noise sample clock PLL• Extremely lexible clocking tree

Page 32: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Sayma RTM

• One PLL mezzanine• Four AFE mezzanines (2 DAC, 2 ADC channels, LO each)

Page 33: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Sayma Analog Frontend Mezzanine

Modular analog mezzanines (application dependent): DC signals, iltering,IQ upconversion/downconversion

Page 34: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Sinara• µTCA crate with AMC, RTM,

MCH crate management

• Telecommunication industrystandard

• Robustness and reliability

• Redundant power supplies,thermal management

• High-performance, well-deined,adaptive cooling

• Multi-gigabit interconnect fabric

• Dedicated and isolated reartransition modules for sensitiveRF components

Page 35: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Sinara DRTIO

• Custom multi-gigabit link for clock, time, and data transfer• Provides sample-accurate reproducible timing over distributed network

of crates

Page 36: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Issue tracking

• Used for software and hardware• Milestones and dashboards for high-level overview

Page 37: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Issue tracking

• Used for software and hardware• Labels for categorizations

Page 38: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Continuous integration

• Multiple kinds of tests and veriication• Linked with source code revision control system• Easy access to deep and inely resolved history of changes

Page 39: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Build Bot

• Automated testing of software, gateware, and hardware• At multiple levels through unit tests, integration tests, and benchmarks• Rapid identiication of beneicial or problematic changes

Page 40: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Build Bot...

...

...• Indiscriminate and complete test suite• Automated tooling for compilation, coniguration, and execution

Page 41: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

Hardware In The Loop (HITL)

• Ensures rapid issue discovery and responsible triage• Dramatically lowers testing complexity and entry barrier for contributors• Allows long term tracking of various igures of merit• Creates conidence in current status

Page 42: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,

ARTIQ and Sinara

Sinara• https://m-labs.hk/artiq• https://github.com/m-labs/sinara

Page 43: LanguagesforMeta-ProgrammableLogicand ... · Sinara • µTCAcratewithAMC,RTM, MCHcratemanagement • Telecommunicationindustry standard • Robustnessandreliability • Redundantpowersupplies,