beyond pcs: accelerator controls on programmable logic pcs: accelerator controls on programmable ......

25
PCaPAC workshop 2006-10-23 Beyond PCs: Accelerator Controls on Programmable Logic Mark Plesko

Upload: voxuyen

Post on 10-May-2018

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

PCaPAC workshop 2006-10-23

Beyond PCs: Accelerator Controls on Programmable

Logic

Mark Plesko

Page 2: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

2

The Three Lifetime Occupations of Cosylab

• See previous workshops and conferences:

• A simple, versatile I/O controller• Java programming• Code generators

• Now, all in one article, all in one chip ☺

Page 3: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

3

Part 1: The “non-plus-ultra” Versatile Controller

• A GSI paper* suggests to make a controller with FPGA instead of CPU– Same hardware board addresses different I/O needs– implement hardware with software

• Motivation:– Reconfigurable hardware (FPGA) is much more flexible than

general purpose CPUs• and even faster despite lower clock rates• But implementations and development effort is high

– vendors offer generic processor cores• VHDL code (e.g., Altera NIOS or Xilinx PicoBlaze), • multiple powerful cores are fixed on the chip

– e.g., Xilinx Virtex II includes PowerPC cores• Mix CPU and logic functionality as needed*M.Sayed, W.Panschow, Actual FPGAs – The Way Out Of Manifold Hardware Problems

Page 4: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

4

Generic Controller Hardware ArchitectureOverview

FPGA

Microprocessor

Cache I/O

RAM (board)

Flash

FPGA cfg (copy 1)

FPGA cfg (copy 2)

ROM (copy 1)

ROM (copy 2)

Filesystem(s)

WishboneMemory access logic

RAM (FPGA)

Module B Module C

Module A

Module D

Page 5: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

5

The Bus(Wishbone)

• Open bus (spec maintained at OpenCores)

• Integration of IP cores on a SoC• Efficient, flexible and easy to work with• Many interconnection types (crossbar, data

flow, point-to-point, shared bus, switched fabric, three-

state)

Page 6: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

6

Peripherals

• Digital I/O: FPGA pins– Need only dedicated transition boards with connectors

• Serial– Open UART core is available– Wishbone compatible

• GPIB:– Commercially available extensions (e.g., National

Instruments, via PCI bus)• System-to-system buses with FPGA:

– ISA (PC104)– VME– PCI– PCIExpress

Page 7: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

7

Network Communication

• For 10/100Mbit ethernet MAC, an open core exists– by Igor Mohor– Wishbone

compatible• For Gbit+ ethernet,

proprietary cores are available

Page 8: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

8

Application Example 1:Nanosecond Resolution Timing

• Delaying of signals relative to a trigger• Sub-nanosecond resolution• Achievable in FPGA with PLLs (0.5ns, 50ps jitter)

• Processor for control and communication

time

trigger

output A

output B

tA

tB FPGA

Delay Generator

Processor

trigger

Wis

hbon

e

output A

output B

Ethernet MAC

Ethernet MII

tA, tB

Page 9: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

9

Application Example 2:Motion Control

• Control of servo, stepper and other kinds of actuators

• Typically implemented with DSPs– Difficult to program and

configure• Co-design:

– SW: motion programs, control, communication

– HW: PID loops (up to several MHz) FPGA

PID 1

Processor

Ethernet MAC

Ethernet MII

PID 2

DAC

DACcfgref

ADC

ADC

Motor 1

Motor 2

Encoder 2

Encoder 1

Page 10: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

10

Application Example 3:Network Traffic Manipulation

• Filtering and routing of packets• Software:

–Control–TCP stack–Signaling

• Hardware:–Gigabit MAC–Filtering–Exotic buffers

FPGA

Wishbone

Processor

Packet filter

Gigabit Ethernet

MAC

Packet filter

Packet buffer

(3-port RAM)

Gigabit Ethernet

MAC

Ethernet B MII

Ethernet A MII

data cfg ctl

Page 11: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

11

Application Example 4:Versatile I/O Controller

• High density, high-performance I/Os– Serial, GPIB, USB, firewire, …– Same board in different

configurations– 10-100 I/Os per FPGA

• Software:– Control and configuration– Communication (with I/Os and/or

SCADA)• Hardware:

– UARTs, USB controllers, …– Multiple cores– Dedicated DSPs (e.g., fireware

camera image processing)– Interlocks on digital inputs FPGA

UART 1

Processor

Ethernet MAC

Ethernet MII

UART 2

GPIB

Firewire

USB

AnalogI/O

DigitalI/O

AD/DA converter

RS-232

RS-485

GPIB

Digital input

Digital outputInterlock

Page 12: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

12

Part II: Put Java on the FPGA !

• FPGAs and cores a nice, but I still want Java!

1. Use of standard Java constructs– Leverage existing development tools– Verifiable byte-code

2. Static checking– Code generation (e.g., drivers for custom

modules)– Register address overlap check/auto-

assignment

Page 13: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

13

Additional Requirements

4. Comply to RealTime Java (RTSJ)• Released first in January 2002,• second release, 1.0.1(b), on May 9th 2006. • specification lead: Peter Dibble of TimeSys

Corporation• a provider of a real-time Linux and a reference

real-time Java implementation 5. Support for debugging

– Serial console– Java remote debugging– JTAG

6. Field upgrade of hardware and software

Page 14: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

14

FPGA Java Processor Core Exists:JOP - Java Optimized Processor

• A processor that executes Java byte-codes– Complex byte-codes implemented in micro-code.– Deterministic behavior

• Occupies 1.0-1.8k LC (NIOS: 1.8k-2.9k);about 30% of Altera Cyclone EP1C6.

• Hello World application:– Boot time: < 10 ms (simulation at 100MHz)– Footprint: 50kB (includes required runtime)

• BAD– A research project

• Requires validation before using in production– Not wishbone compliant (requires a wrapper)– Not RTSJ (Realtime Specification for Java) compliant

Page 15: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

15

Processor Core(Java Optimized Processor)

Page 16: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

16

Hello World on FPGA

Page 17: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

17

Extending the Processor:Hyper-threading

• JOP core component instantiated more than once• Advantages:

– Improved processing power– Decreased latencies– Dedicated core for real-time tasks

• Issues:– Multiple masters for memory and I/O buses

(arbiter needed)– Hardware implementation of Java’s

synchronization locks– Task scheduler needs to be aware of multiple

cores

Page 18: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

18

Hardware ArchitectureOverview

FPGA

Java Optimized Processor

Java Optimized Processor

RAM (stack)

Cache

Microcode ROM

SimpConI/O

RAM (board)

Flash

FPGA cfg (copy 1)

FPGA cfg (copy 2)

ROM (copy 1)

ROM (copy 2)

Filesystem(s)

WishboneMemory access logic

RAM (FPGA)

Module B Module C

Module A

Module D

Page 19: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

19

Part III: Generators for Everything (also for new buzzwords?)

• Development on a Java-like platform is more efficient than using other tools– “Nearly everyody” knows Eclipse

• But need to define hardware in VHDL• A hardware-software co-design

approach would ameliorate the disadvantage

Page 20: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

20

Proposed Development Workflow

Generate JVM (Java)

Define platform

Generate hardware (VHDL)

ManualAutomated

Implement software

Automated tests on workstation

Design board (pin layout)

Synthesize and route hardware

Prepare and upload flash

image

Page 21: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

21

Software ArchitectureOverview

Driv

er A

Driv

er B

Driv

er C

inte

rrup

ts

Page 22: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

22

Sample Java Codeclass MySystemOnChip extends SystemOnChip {public void defineHardware() {

this.setDescription("Digital and serial I/O controller");wb = new WishboneBus("wb");this.addBus(wb);...jop0 = new JavaProcessor("jop0");jop0.has FloatingPoint(true);wb.addMaster(jop0);...flash0 = new CompactFlash("flash0");flash0.addPartition("fpgacfg0", 512*kB);flash0.addPartition(“hda0");...eth0 = new OpenCoresEthernet("eth0");wb.addSlave(eth0);...

}; // defineHardware method

Page 23: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

23

Build Your Own Operating System with Java Code

public void init() {initDrivers();initMemoryManager();initFileSystem();initNetwork();initScheduler();initServices();run();

}public void initNetwork() {

// set the MAC address of the Ethernet adaptereth0.setMACVendor(0x00CAFE);eth0.setMACSerial((this.getSerial() & 0xFFFF) << 8);

// initialize the IP protocol (version 4)ip = new InternetProtocolV4();// tell the Ethernet driver to dispatch events to IP protocoleth0.addProtocol(ip);...

}

Page 24: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

24

What Needs to be Developed To Make it Work

–Java remote debugging–GPIB, UART, PID, memory access logic, field update

–Ethernet, TCP/IP stack–JOP JVM refactoring, garbage collector

–Platform generator, documentation, testing, developer education

Page 25: Beyond PCs: Accelerator Controls on Programmable Logic PCs: Accelerator Controls on Programmable ... • Control of servo, ... PID 2 DAC DAC cfg ref ADC ADC Motor 1 Motor 2 Encoder

25

Conclusion

• HW/SW co-design has already been shown to be effective with FPGA cores

– Development productivity greatly improves (WRT plain VHDL)

• With Eclipse and Java, productivity increase could be even more significant

• But the proposed architecture requires still a significant effort to realize

– Nice research project