the promise of embedded design generation turning coders

81
Turning Coders into Makers: The Promise of Embedded Design Generation Rohit Ramesh, Richard Lin, Antonio Iannopollo, Alberto Sangiovanni-Vincentelli, Björn Hartmann, Prabal Dutta SITP Retreat 2017

Upload: others

Post on 16-Nov-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Promise of Embedded Design Generation Turning Coders

Turning Coders into Makers: The Promise of Embedded Design Generation

Rohit Ramesh, Richard Lin, Antonio Iannopollo,Alberto Sangiovanni-Vincentelli, Björn Hartmann, Prabal Dutta

SITP Retreat 2017

Page 2: The Promise of Embedded Design Generation Turning Coders

Embedded Development is a key part of the maker movement.

2

Page 3: The Promise of Embedded Design Generation Turning Coders

Embedded Development is a key part of the personal fabrication movement.

3

More accessible and usable parts.

Page 4: The Promise of Embedded Design Generation Turning Coders

Embedded Development is a key part of the personal fabrication movement.

4

More accessible and usable parts.

Cheaper board fabrication.

Page 5: The Promise of Embedded Design Generation Turning Coders

Embedded Development is a key part of the personal fabrication movement.

5

More accessible and usable parts.

Cheaper board fabrication.

Low entry requirements.

Page 6: The Promise of Embedded Design Generation Turning Coders

Embedded Development is a key part of the personal fabrication movement.

6

More accessible and usable parts.

Cheaper board fabrication.

Low entry requirements.

Design is still a major bottleneck!

Page 7: The Promise of Embedded Design Generation Turning Coders

We want to go from idea to finished device.

7

When the button is pressed, the light should blink.

Page 8: The Promise of Embedded Design Generation Turning Coders

Designing the circuit takes significant domain knowledge.

8

“What I found challenging was to understand what are the components that have to be paired with the basic components that you are buying.”

- Luisa, closing discussion [Mellis et al. 2016]

We also observed participants struggling to coordinate information from diverse sources,

- Mellis et al. [2016]

When the button is pressed, the light should blink.

Page 9: The Promise of Embedded Design Generation Turning Coders

Designing the circuit takes significant domain knowledge.

9

● What should the circuit have in it?

“What I found challenging was to understand what are the components that have to be paired with the basic components that you are buying.”

- Luisa, closing discussion [Mellis et al. 2016]

We also observed participants struggling to coordinate information from diverse sources,

- Mellis et al. [2016]

When the button is pressed, the light should blink.

Page 10: The Promise of Embedded Design Generation Turning Coders

Designing the circuit takes significant domain knowledge.

10

● What should the circuit have in it?

● What do I need to check in order to verify part compatibility?

“What I found challenging was to understand what are the components that have to be paired with the basic components that you are buying.”

- Luisa, closing discussion [Mellis et al. 2016]

We also observed participants struggling to coordinate information from diverse sources,

- Mellis et al. [2016]

When the button is pressed, the light should blink.

Page 11: The Promise of Embedded Design Generation Turning Coders

Designing the circuit takes significant domain knowledge.

11

● What should the circuit have in it?

● What do I need to check in order to verify part compatibility?

● How do I even figure out what parts I want to use?

“What I found challenging was to understand what are the components that have to be paired with the basic components that you are buying.”

- Luisa, closing discussion [Mellis et al. 2016]

We also observed participants struggling to coordinate information from diverse sources,

- Mellis et al. [2016]

When the button is pressed, the light should blink.

Page 12: The Promise of Embedded Design Generation Turning Coders

This domain knowledge is often hard for novices to acquire.

12

“What I found challenging was to understand what are the components that have to be paired with the basic components that you are buying.”

- Luisa, closing discussion [Mellis et al. 2016]

When the button is pressed, the light should blink.

Page 13: The Promise of Embedded Design Generation Turning Coders

Automation makes PCB design much easier.

13

“The auto-router was magical. It was cool watching all the wires go bo-bo-bo-bop.”

- Tyler [Mellis et al. 2016]

Breadboard Design, Manual PCB Design, or Autorouting

Page 14: The Promise of Embedded Design Generation Turning Coders

Working with the firmware is just coding.

14

Debug and deploy firmware

#import “arduino.h”#import “button_driver.h”

BUTTON button;GPIOLED light;

void setup() { button.init(GPIO3); light.init(GPIO4);}

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

● The circuit has to be designed first so we have information about connectivity and interfaces.

● Arduino and other frameworks wrap low-level abstractions in nice, comprehensible interfaces.

Page 15: The Promise of Embedded Design Generation Turning Coders

We want to minimize the amount of knowledge needed to design electronics.

15

Page 16: The Promise of Embedded Design Generation Turning Coders

We want to minimize the amount of knowledge needed to design electronics.

16

Anyone who can program should be able to design an embedded device

● There are many more programmers than electrical engineers.

● This applies for professionals and hobbyists.

Page 17: The Promise of Embedded Design Generation Turning Coders

Embedded firmware requires domain knowledge to write.

17

#import “arduino.h”#import “button_driver.h”

BUTTON button;GPIOLED light;

void setup() { button.init(GPIO3); light.init(GPIO4);}

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Requires finished circuit diagram, and the knowledge

to create it.

Captures the function of the device at a high level.

Page 18: The Promise of Embedded Design Generation Turning Coders

#import “arduino.h”#import “button_driver.h”

BUTTON button;GPIOLED light;

void setup() { button.init(GPIO3); light.init(GPIO4);}

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

We can make a version that doesn’t need that domain knowledge.

18

Ask for properties that matter to you, don’t

waste time picking parts.

Captures the function of the device at a high level.

Annotated CodeA mockup of the input format for EDG, designed to allow people to specify devices without needing to know electrical engineers.

Page 19: The Promise of Embedded Design Generation Turning Coders

#import “arduino.h”#import “button_driver.h”

BUTTON button;GPIOLED light;

void setup() { button.init(GPIO3); light.init(GPIO4);}

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

EDG takes annotated code and a library of parts and produces SW and HW.

19

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = blue);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Page 20: The Promise of Embedded Design Generation Turning Coders

Embedded design generation uses constraint solving tools to do this.

20

Page 21: The Promise of Embedded Design Generation Turning Coders

Embedded design generation uses constraint solving tools to do this.

21

Space of Possible Designs

Page 22: The Promise of Embedded Design Generation Turning Coders

Embedded design generation uses constraint solving tools to do this.

22

Space of Possible Designs

Portion of designs that satisfy specification.

Page 23: The Promise of Embedded Design Generation Turning Coders

Embedded design generation uses constraint solving tools to do this.

23

Space of Possible Designs

Portion of designs that satisfy specification.

Page 24: The Promise of Embedded Design Generation Turning Coders

Embedded design generation uses constraint solving tools to do this.

24

Space of Possible Designs

Portion of designs that satisfy specification.

Page 25: The Promise of Embedded Design Generation Turning Coders

#import “arduino.h”#import “button_driver.h”

BUTTON button;GPIOLED light;

void setup() { button.init(GPIO3); light.init(GPIO4);}

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Turn coders into makers, through the power of constraint solvers

25

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = blue);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Page 26: The Promise of Embedded Design Generation Turning Coders

Outline

26

● The EDG Methodology● Proof-of-Concept and Evaluation● Discussion and Future Work

Page 27: The Promise of Embedded Design Generation Turning Coders

The EDG Methodology

27

Page 28: The Promise of Embedded Design Generation Turning Coders

How do we represent the parts our tool has available?

28

We represent hardware and firmware components as blocks

in a block diagram

Page 29: The Promise of Embedded Design Generation Turning Coders

Blocks are made up of a number of sub elements.

29

Page 30: The Promise of Embedded Design Generation Turning Coders

Blocks are made up of a number of sub elements.

30

Ports Digital Signal Input User Facing Button API and Hardware API

Page 31: The Promise of Embedded Design Generation Turning Coders

Blocks are made up of a number of sub elements.

31

Ports

Implementation

Digital Signal Input User Facing Button API and Hardware API

Code that wraps the HW API in a nice interface.

Page 32: The Promise of Embedded Design Generation Turning Coders

32

Ports

Implementation

Metadata

Digital Signal Input User Facing Button API and Hardware API

Code that wraps the HW API in a nice interface.

LED Color, Input Voltage API use and connectivity

Blocks are made up of a number of sub elements.

Page 33: The Promise of Embedded Design Generation Turning Coders

33

Ports

Implementation

Metadata

Conditions

Digital Signal Input User Facing Button API and Hardware API

Code that wraps the HW API in a nice interface.

LED Color, Input Voltage API use and connectivity

Blocks are made up of a number of sub elements.

Page 34: The Promise of Embedded Design Generation Turning Coders

Conditions allow us to specify the operating conditions of a component.

34

Page 35: The Promise of Embedded Design Generation Turning Coders

Conditions allow us to specify the operating conditions of a component.

35

LiPo Battery Mains Power

Page 36: The Promise of Embedded Design Generation Turning Coders

Conditions allow us to specify the operating conditions of a component.

36

LiPo Battery Mains Power

Input Voltage = 120vInput Voltage = 3.7v Metadata

Page 37: The Promise of Embedded Design Generation Turning Coders

Conditions allow us to specify the operating conditions of a component.

37

LiPo Battery Mains Power

Input Voltage = 120vInput Voltage = 3.7v

Input voltage is above 1.2v and below 5v

Input voltage is above 1.2v and below 5v

Metadata

Conditions

Page 38: The Promise of Embedded Design Generation Turning Coders

Conditions encode the functional correctness of a block.

38

Ports

Implementation

Metadata

Conditions

Digital Signal Input User Facing Button API and Hardware API

Code that wraps the HW API in a nice interface.

LED Color, Input Voltage API use and connectivity

Input voltage is above 1.2v and below 5v

If button API is used, then GPIO API must be active

Page 39: The Promise of Embedded Design Generation Turning Coders

The annotated code has to actually run on the device, and can be in a block.

39

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Page 40: The Promise of Embedded Design Generation Turning Coders

The annotated code has to actually run on the device, and can be in a block.

40

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Control Logic: Block created by parsing annotated code, which will eventually run on the device.

Page 41: The Promise of Embedded Design Generation Turning Coders

The annotated code has to actually run on the device, and can be in a block.

41

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Control Logic: Block created by parsing annotated code, which will eventually run on the device.

Implementation

Page 42: The Promise of Embedded Design Generation Turning Coders

The annotated code has to actually run on the device, and can be in a block.

42

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Control Logic: Block created by parsing annotated code, which will eventually run on the device.

Implementation

Page 43: The Promise of Embedded Design Generation Turning Coders

The annotated code has to actually run on the device, and can be in a block.

43

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Control Logic: Block created by parsing annotated code, which will eventually run on the device.

Implementation

Conditions Both the ports must be provided a valid api to the corresponding physical component.

Page 44: The Promise of Embedded Design Generation Turning Coders

Solvers find variable assignments such that some set of constraints hold;

44

A < 12B = 3 + AC > 0C = 3 - A

A = 2B = 5C = 1Solve

Variables

Constraints

SolutionSolve

A < 12B = 3 + AC > 0C = 3 - A

A = 2B = 5C = 1Solve

● The solver finds one assignment such that every constraint is met

● The solver is nondeterministic and might output any of the valid assignments.

Page 45: The Promise of Embedded Design Generation Turning Coders

We can combine every block in the library, and all possible potential links.

45

Page 46: The Promise of Embedded Design Generation Turning Coders

A pegboard connection is a block diagram

46

Page 47: The Promise of Embedded Design Generation Turning Coders

Mix with block conditions and control logic, and bake

47

A < 12B = 3 + AC > 0C = 3 - A

A = 2B = 5C = 1Solve

Metadata

Conditions

Variables

Constraints

Solution Block DiagramSolve

A < 12B = 3 + AC > 0C = 3 - A

A = 2B = 5C = 1Solve

● The solver finds one assignment such that every constraint is met

● The solver is nondeterministic and might output any of the valid assignments.

Page 48: The Promise of Embedded Design Generation Turning Coders

48

We can instantiate a design from the solver output

Page 49: The Promise of Embedded Design Generation Turning Coders

49

We can instantiate a design from the solver output

Page 50: The Promise of Embedded Design Generation Turning Coders

50

Page 51: The Promise of Embedded Design Generation Turning Coders

51

We have gone from a high-level specification and a set of parts, to a design that can be realized.

Page 52: The Promise of Embedded Design Generation Turning Coders

Proof-of-Concept and Evaluation

52

Page 53: The Promise of Embedded Design Generation Turning Coders

Our prototype translates the EDG methodology onto available tools.

53

● The tool is built with Haskell on top of the Z3 constraint solver.

● Parsing and design instantiation is still manual to allow for faster iteration on the system internals.

Page 54: The Promise of Embedded Design Generation Turning Coders

54

Our test library has a wide variety of parts

Images from sparkfun.com, under a CC-BY 2.0 license

Page 55: The Promise of Embedded Design Generation Turning Coders

55

Can we generate designs at all?

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Page 56: The Promise of Embedded Design Generation Turning Coders

56

Can we generate designs at all? Yes!

peripheral button = new MomentarySwitch();

peripheral light = new LED(color = Red);

void loop() { if(button.isPressed()){

light.toggle(); } else {

light.off(); } delay(1000); //milliseconds}

Page 57: The Promise of Embedded Design Generation Turning Coders

We use symmetries to collapse the rest of our diagrams further.

57

Page 58: The Promise of Embedded Design Generation Turning Coders

We use symmetries to collapse the rest of our diagrams further.

58

Page 59: The Promise of Embedded Design Generation Turning Coders

AdafruitChassisMotor motorL();AdafruitChassisMotor motorR = duplicate motorL;ReflectanceSensor lineSenseL(distance >= 1cm);ReflectanceSensor lineSenseR = duplicate lineSenseL;Battery power(duration >= 10mins);

const int baseSpeed = 100;const int baseTurn = 25;const int lightThreshold = 70;

int loop(){ static int differential = 0; ...

59

Can the user specify exact parts? Handle complex power systems?

Page 60: The Promise of Embedded Design Generation Turning Coders

AdafruitChassisMotor motorL();AdafruitChassisMotor motorR = duplicate motorL;ReflectanceSensor lineSenseL(distance >= 1cm);ReflectanceSensor lineSenseR = duplicate lineSenseL;Battery power(duration >= 10mins);

const int baseSpeed = 100;const int baseTurn = 25;const int lightThreshold = 70;

int loop(){ static int differential = 0; ...

60

Can the user specify exact parts? Handle complex power systems?

Page 61: The Promise of Embedded Design Generation Turning Coders

61

Can the user specify exact parts? Handle complex power systems?

Page 62: The Promise of Embedded Design Generation Turning Coders

62

Can the user specify exact parts? Handle complex power systems? Yes

Page 63: The Promise of Embedded Design Generation Turning Coders

63

Does our system preserve functionality even when the library changes?

● 4 colored, light-up buttons

● Play a pattern, ask the user to press the buttons in the same order.

Page 64: The Promise of Embedded Design Generation Turning Coders

64

Does our system preserve functionality even when the library changes?

Page 65: The Promise of Embedded Design Generation Turning Coders

65

Does our system preserve functionality even when the library changes?

GPIO expander component

inferred!

Page 66: The Promise of Embedded Design Generation Turning Coders

66

Does our system preserve functionality even when the library changes?

Power amplifiers added to deal with

complex power system..

Page 67: The Promise of Embedded Design Generation Turning Coders

67

Does our system preserve functionality even when the library changes? Yes

Power amplifiers added to deal with

complex power system..

Page 68: The Promise of Embedded Design Generation Turning Coders

68

We also built other designs, including a datalogger and control system.

Page 69: The Promise of Embedded Design Generation Turning Coders

Performance is decent for small problem sizes.

69

For simple designs, our tool has taken around 3 hours in the most realistic tests. Mind, that’s still time you could be doing something else.

Page 70: The Promise of Embedded Design Generation Turning Coders

Discussion and Future Work

70

Page 71: The Promise of Embedded Design Generation Turning Coders

There are many things that need further research.

71

● Performance scales exponentially, and will never be a lower complexity class.

○ But there’s still immense room for optimization. Including library pruning, and more efficient encoding of constraints.

Page 72: The Promise of Embedded Design Generation Turning Coders

There are many things that need further research.

72

● Performance scales exponentially, and will never be a lower complexity class.

○ But there’s still immense room for optimization. Including library pruning, and more efficient encoding of constraints.

● We need some way for the user to figure out what their specifications actually mean, especially for large classes of wildly different parts.

Page 73: The Promise of Embedded Design Generation Turning Coders

There are many things that need further research.

73

● Performance scales exponentially, and will never be a lower complexity class.

○ But there’s still immense room for optimization. Including library pruning, and more efficient encoding of constraints.

● We need some way for the user to figure out what their specifications actually mean, especially for large classes of wildly different parts.

● We need to do research on making our system more expressive, as of now it cannot handle things like timing requirements or isolated power domains.

Page 74: The Promise of Embedded Design Generation Turning Coders

EDG can help automate optimization

74

Page 75: The Promise of Embedded Design Generation Turning Coders

EDG can help automate optimization

75

Page 76: The Promise of Embedded Design Generation Turning Coders

EDG can help automate optimization

76

Page 77: The Promise of Embedded Design Generation Turning Coders

EDG can help automate optimization

77

Page 78: The Promise of Embedded Design Generation Turning Coders

EDG can help automate optimization

78

Page 79: The Promise of Embedded Design Generation Turning Coders

EDG can help automate optimization

79

Page 80: The Promise of Embedded Design Generation Turning Coders

Questions?

80

Page 81: The Promise of Embedded Design Generation Turning Coders

81