connectal) - ucf department of eecss day/session2-talk2.pdf · ) 6 external) device)...
TRANSCRIPT
![Page 1: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/1.jpg)
Connectal
A Framework for So2ware-‐Driven Hardware Development
Myron King, Jamey Hicks, John Ankcorn Quanta Research Cambridge
![Page 2: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/2.jpg)
Suppose you want to build a wheeled zedboard robot
• Buy robot kit – Some assembly required
• Start wriHng so2ware – BaIeries not included – Much assembly required – Zedboard embedded Linux tutorial 52 steps!
– How many steps and files are really required?
– How do I connect HW to SW? www.connectal.org 2
![Page 3: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/3.jpg)
Suppose you want to build a big data analy:cs accelerator?
• Use off-‐the-‐shelf FPGA board • Build a Flash daughter card • Start wriHng so2ware
– How many steps and files are really required?
– Can’t I focus on the applicaHon?
– Can I use python or javascript? – What if I change which FPGA board I use?
www.connectal.org 3
![Page 4: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/4.jpg)
• MoHvaHon • Target Systems • ConnecHng Hardware to So2ware • Sharing Memory • What is Connectal?
www.connectal.org 4
Talk Outline
![Page 5: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/5.jpg)
Host System PCIe Expansion Card
flash chip
flash chip
flash chip
flash chip
FPGA
System Memory
X86 CPU
DDR PCIe
5 www.connectal.org
Target Systems
Host System PCIe Expansion Card
FPGA
System Memory
X86 CPU PCIe
Embedded System
System Memory
ARM CPU AXI
video
sonar
h bridge
gyro
FPGA
AcceleraHng data-‐centers
Controlling embedded systems
Novel architectures for Big Data
Many common implementaHon challenges
![Page 6: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/6.jpg)
www.connectal.org 6
External Device Gyroscope Sensor
FPGA Sensor Interface
Linux Kernel Sensor Device Driver
User Space Robot Control So2ware
Zedboard Robot So2ware Stack Using Connectal
• 3 user-‐defined components • Each with its own computaHonal
model • Each with its own programming
language • Can we eliminate the need for
the Sensor Device Driver? • Yes: User-‐mode access to
hardware • Now only 2 user-‐defined
components!
![Page 7: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/7.jpg)
ConnecHng Hardware to So2ware
Verilog module gyro( input CLK, ... ); ... endmodule
So=ware gyro-‐>sample(...)
www.connectal.org 7
HW/SW Impedance Mismatch!
![Page 8: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/8.jpg)
BSV reduces the gap
BSV module gyro(Gyro); method AcHon sample(...); ... endmethod ... endmodule
So=ware gyro-‐>sample(...)
www.connectal.org 8
A BSV method is like an AXI stream port to a Verilog module
![Page 9: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/9.jpg)
Asynchronous Remote Method InvocaHon
• Long latency to hardware -‐> asynchronous • So2ware invokes remote so2ware by sending a message through a socket or shared memory
• So2ware invokes hardware by sending a message
• Hardware invokes so2ware by sending a message
www.connectal.org 9
![Page 10: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/10.jpg)
Invoking Methods through Portals
• Define HW/SW interfaces using BSV
• Connectal generates code to marshall/demarshall messages
www.connectal.org 10
interface StrstrRequest; method Action setup(Bit#(8) needle_char); method Action search(Bit#(32) haystack_ptr, Bit#(32) haystack_len);endinterface
interface StrstrIndication; method Action found(Int#(32) v);endinterface
![Page 11: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/11.jpg)
main app HW
req:: proxy
event lib
HW wrapper bus driver
app.methodName()
HW fifos
fifo.notFullReq()
fifo.write()
userIfc.methodName ()
fifo.notFullResp)
fifo.rdReq()
fifo.rdResp()
So2ware Invokes Hardware
![Page 12: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/12.jpg)
main app HW
ind:: wrapper
event lib
HW proxy bus driver
userIfc.methodName()
wake_up()
HW fifos
poll()
disableInt()
return()
lib.portalExec_poll()
signalInt()
enableInt()
lib.portalExec_event()
Hardware Wakes up So2ware
fifo.enq()
![Page 13: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/13.jpg)
main app HW
ind:: wrapper
event lib
HW proxy bus driver
userIfc.methodName()
fifo.enq()
HW fifos
fifo.notEmptyReq()
fifo.readReq()
fifo.readResp()
lib.portalExec_event()
ind.methodName()
fifo.notEmptyResp()
Hardware Invokes So2ware
![Page 14: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/14.jpg)
Portal Message Transports
• Just showed memory mapped hardware FIFOs • Other opHons
– Shared memory FIFOs
• So2ware-‐to-‐So2ware IPC – Shared memory FIFOs – Unix Sockets – TCP – Web Sockets (to talk to your Javascript!)
• Binary or JSON message encoding www.connectal.org 14
![Page 15: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/15.jpg)
Sharing Memory (DMA)
• Achieving performance goals o2en requires direct HW access to shared memory – String search example – Samples from sensors such as gyroscope
• PortalMem – Provides reference-‐counted sharing of memory buffers between user processes and HW
– Provides logical/physical translaHons of non-‐conHguous physical memory for HW
www.connectal.org 15
![Page 16: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/16.jpg)
Shared Memory HW • Simple MMU for non-‐conHguous physical regions • BSV libraries for bus-‐mastering (DMA engines) • Infra for sharing full-‐speed bus access among many hardware
clients
www.connectal.org 16
![Page 17: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/17.jpg)
17 www.connectal.org
The Connectal Framework
1. Easy declaraHon and invocaHon of remote methods between host so2ware and FPGA using Portals
2. Direct user-‐mode access to accelerators from so2ware
3. High performance read/write bus master access to system memory from FPGA
4. Infrastructure for sharing full-‐speed memory port access between clients in FPGA
5. Portability across plarorms (CPUs, OperaHng Systems, buses, FPGAs)
6. Fully integrated tool-‐chain support for dependency builds and device configuraHon
![Page 18: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/18.jpg)
Connectal Framework
• Minimal source code needed – App.cpp – App.bsv – Makefile – Pins.json (opHonal)
• Provides a streamlined flow for building and running HW/SW apps – make build.zedboard – make run.zedboard
• Cloud-‐based toolchain available www.connectal.org 18
![Page 19: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/19.jpg)
19 www.connectal.org
Plarorm Portability and Tool Chain Support
Tool-‐chain support • Available as a service at connectalbuild.qrclab.com • Program some devices directly from your browser
KC705 VC707 ZYBO Zedboard ZC702 ZC706 Parallela
PCIe AXI
x86 ARM Bluesim
Ubuntu Centos Ubuntu Android Ubuntu Centos
Zynq Mini-‐ITX
![Page 20: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/20.jpg)
Connectal
• Open source on github: – hIps://github.com/cambridgehackers/connectal
• DocumentaHon (some) – hIp://www.connectal.org/
• Public build service – Free for open source projects – Compile and run on your zedboard with zero so2ware installs
– hIp://build.connectal.org/ www.connectal.org 20
![Page 21: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/21.jpg)
BACKUP
www.connectal.org 21
![Page 22: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/22.jpg)
22 www.connectal.org
What is a Portal?
Using Bluespec System Verilog (BSV), the user declares logical groups of unidirecHonal “send” methods, each of which is implemented as a fifo channel by the Connectal interface compiler; all channels corresponding to a single BSV interface are grouped together into a single portal.
![Page 23: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/23.jpg)
23 www.connectal.org
Remote Methods through Portals
Legend: User generated Connectal generated
1. Define HW/SW interfaces using BSV 2. Invoke interface compiler to generate
Wrappers and Proxies 3. Connect user-‐so2ware and user-‐
hardware using generated “glue”
void found(int loc){ … }
Main(){ … configure(‘a’); configure(‘b’); search(hptr,hlen); … }
IndicaHon Wrapper
Request Proxy
IndicaHon Proxy FIFO
Request Wrapper FIFO
A B
C D
write
read&deq
H/W bus
User Hardware
User So2ware interrupt
HW-‐>SW portal
SW-‐>HW portal
![Page 24: Connectal) - UCF Department of EECSs Day/Session2-talk2.pdf · ) 6 External) Device) GyroscopeSensor FPGA) Sensor)Interface) Linux Kernel) SensorDeviceDriver) User) Space) RobotControl)So2ware)](https://reader035.vdocuments.net/reader035/viewer/2022071013/5fcb5842fe81cb3a312f2916/html5/thumbnails/24.jpg)
24 www.connectal.org
Linux
Connectal Device Driver -‐Portal discovery -‐Create /dev/portalXXX -‐Register ISR -‐MMAP Interrupt Service RouHne
void found(int loc){ … }
Main(){ … portalExec_start(); configure(‘a’); configure(‘b’); search(hptr,hlen); …}
IndicaHon Wrapper
Request Proxy
IndicaHon Proxy FIFO
Request Wrapper FIFO
A B
C D
write
read&deq
interrupt
H/W bus
User Hardware
User So2ware
Poller void* PortalPoller::portalExec(void* __x){ while (1) { portalExec_poll(portalExec_Hmeout); portalExec_event(); }}
Connectal Libraries
IndicaHon Thread poll
Remote Methods through Portals Legend: User generated Connectal generated Connectal libraries Linux