Top Banner
RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee
42

RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Dec 13, 2015

Download

Documents

John Powers
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

RAL-PPD Academic Training 2011-2012

Computer – Hardware Interactions

(with emphasis on VME)

1-Feb-2012

      Norman Gee

Page 2: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Overview

- Introduction to CPU relationship with Memory

- VMEbus, with a short interlude on VME cycle internals

- Interfacing between Computer and VMEbus

- DMA and VME extensions

- Interrupts, Error handling

- Practical Hints and Tips

- Summary

- Bibliography

- Q&A – welcome at any time

Who am I?

- Group leader (ATLAS, L1Calo) in Particle Physics Dept at RAL

- Working on ATLAS since March 1992. Atlas TDAQ upgrade coordinator

Norman Gee - Computers interacting with Hardware 2

Page 3: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Introduction

.L33:

cmpl $255, -28(%ebp)

jle .L36

jmp .L31

.L36:

movl -24(%ebp), %edx

movl -28(%ebp), %eax

subl %edx, %eax

movl %eax, -44(%ebp)

movl -44(%ebp), %eax

movl -1080(%ebp,%eax,4), %eax

movl %eax, -1084(%ebp)

movl -1088(%ebp), %edx

movl %edx, %eax

sall $2, %eax

addl %edx, %eax

leal (%eax,%eax), %ecx

movl -1092(%ebp), %edx

movl %edx, %eax

• Compilers (gcc, g++) have an option ‘-S’ to generate the assembler code listing. Here’s a short fragment:

• The instructions – most of them – which have (%xxx) indirect addressing syntax for operands are addressing memory to fetch or store values

• Of course, the instructions themselves have to be fetched from memory as well

• There’s a subterranean layer of microcode or firmware doing all this, that you never see

A moment of Nostalgia: original VAX 11/780 (~1980) computers read the microcode from a 8-inch floppy

Norman Gee - Computers interacting with Hardware 3

Page 4: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Physical Memory and I/O Ports

• In early CPUs, instructions directly access the physical memory

– i.e. pins on the CPU device directly connect to the memory address and data lines

• Any other hardware is connected via ‘I/O ports’

– i.e. CPU pins which come from a CPU register

– (i.e.)2 writing some 0’s and 1’s to the register creates a matching pattern of +5V or 0V on the pins

• Used in most early PCs; also current microcontrollers and CPUs embedded in FPGAs

Memory

CPU

Load

Store

I/O Port

Norman Gee - Computers interacting with Hardware 4

Page 5: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Physical Memory and I/O Port limitations (1): I/O speed

• Data from our HEP detector electronics has to be read via the I/O port:

– Send some command & address to the detector electronics via the I/O port (2-3 CPU instructions);

– Reading response and store in memory (2-3 more CPU instructions);

– Increment counters and addresses (another 2-3 CPU instructions)

– Overall speed is limited to ~ 1/10 of CPU (and memory) frequency

• Solution: add a specialised pump just to move bulk data fast - Direct Memory Access (DMA - more later).

– Data goes direct to memory, not via CPU

Memory

CPU

Load

Store

I/O Port

Store

I/O Port

DMA

Norman Gee - Computers interacting with Hardware 5

Page 6: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Physical Memory limitations (2): Memory-specific problems

1. It is hard to run a program bigger than the physical memory

– need to use Overlays (stored on disk)

2. If multiple programs are loaded, any of them can write over the others (and over your own code)

– It’s very easy to do this accidentally if your code uses arrays or pointers

– Minimise by adding Memory Bounds

3. The system suffers from memory fragmentation. Here a system is running two programs. It has 8 memory slots free, but we can’t run a program needing 6 slots

– The only good answer to this is to use Virtual Memory

Memory

Norman Gee - Computers interacting with Hardware 6

Page 7: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Virtual Memory

Virtual AddressSpace

Address pointer (32 bits)

Page No Offset

Physical Page No Offset

Physical AddressSpace

Page Table

12 bits20 bits

P

0123

1

0

3

2

Virtual Page NumbersVirtual pages scatteredin physical memory

• Create two separate address spaces:

• Physical – the actual storage

• Virtual – where programs (i.e. instructions) run. Each program normally has its own separate Virtual address space(addr’s in %xxx registers are Virtual)

• Both spaces are organised in ‘pages’, typically 4 kB long

i.e. with offset addresses 0 – 4095 (12 bits)

• The Virtual/Physical interface allows virtual pages to be anywhere in physical space

Norman Gee - Computers interacting with Hardware 7

Page 8: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

8

Mapped I/O - Virtual Memory

32-bit Virtual Address Space

Address pointer (32 bits)

Page No Offset

Physical Page No Offset

Physical Address Space

Page Table

12 bits20 bits

P

0123

1

0

3

2

Virtual Page NumbersVirtual pages scatteredin physical memory

0123456789

10111213141516171819

60

1614

11110000000

Norman Gee - Computers interacting with Hardware 8

Page 9: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Virtual Memory

• CPU microcode translates virtual to physical addresses using the page tables

– Adjacent virtual pages can be physically discontiguous – solves the fragmentation problem

• Some physical memory isn’t mapped in your page tables

– Solves the memory protection problem

• Some temporarily unused virtual address space can be on disk instead of in memory – (paging, swapping) – can run programs larger than physical memory

• An extra tweak is to arrange thatsome pages can only be accessedby privileged code -> More versatile memory protection

32-bit Virtual Address Space

Address pointer (32 bits)

Page No Offset

Physical Page No Offset

Physical Address Space

Page Table

12 bits20 bits

P

0123

1

0

3

2

Virtual Page NumbersVirtual pages scatteredin physical memory

0123456789

10111213141516171819

60

1614

11110000000

Norman Gee - Computers interacting with Hardware 9

Page 10: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Virtual Memory - Issues

• The page table is itself held in memory, so virtual-to-physical translation involves an extra memory read … which could slow us down

– The CPU has a cache of translated (page) addresses - “Translation Lookaside Buffer” TLB

• There is a separate page table for each task, so they may be swapped or paged themselves

– The system will do this invisibly for you

• Programs often use ‘stack’ space for storage of temporary variables. The stack normally lives in high virtual memory so that it can expand downwards

– Even though fairly empty, the page table has to cover the whole 32-bit or 64-bit virtual address range, so gets BIG (for small utilities, could be bigger than the code)

– The answer is to break the page table into sub-tables – ‘segments’

Norman Gee - Computers interacting with Hardware 10

Page 11: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Segmented Page Tables and Hardware (Intel PAE)

Physical space can be >32 bits,e.g. x86-64 is up to 48 bits = 2TB

Norman Gee - Computers interacting with Hardware 11

Virtual Address Space

Address pointer (32 bits)

VPN1 VPN2 Offset

Physical Page No Offset

Physical Address Space

Page Directory

12 bits

10 bits

Page Tables

10 bits

PDBRP

0123

1

0

3

2n

n

Page 12: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Connect the Hardware…

• We can now attach an experiment in the modern style:

– Build an interface so that the (experiment) hardware looks like memory

• When plugged in, it will appear in the physical address space

– at addresses above the physical memory

– consuming complete pages, starting on a page boundary

• To make these new “memory” pages visible to your program:

– Run some privileged code to create new, empty virtual address pages

– and to map these to the hardware addresses

• Your program will see the hardware at virtual addresses

– Note that although the hardware addresses are fixed, other programs may see the same hardware (via their page tables) at different virtual addresses

• The privileged software codes are part of the Device Driver that will manage VME for all users

Norman Gee - Computers interacting with Hardware 12

Page 13: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Accessing Mapped Hardware

Virtual Address Space

Address pointer (32 bits)

VPN1 VPN2 Offset

Physical Page No Offset

Physical Address Space

Page Directory

12 bits

10 bits

Page Tables

10 bits

PDBRP

0123

1

0

3

2n

n

HW1HW1

Attached hardware occupyingphysical addresses

Norman Gee - Computers interacting with Hardware 13

Page 14: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Pause for Breath

• Summary: Hardware needs to behave like memory, and we access it in just the same way from software – you just need to know where it is

• Any specific privileged system software to initialise and access the interfaces and mapping will be in a Device Driver, normally loaded at boot time

• Questions so far?

Note: b=bit, B=Byte. B/s = 8 x b/s

M=106, G=109, T=109, but k=103

Norman Gee - Computers interacting with Hardware 14

Page 15: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VMEbus

• VMEbus is an international standard. It is used in nearly every HEP experiment to connect computers to detectors, using a mix of commercial and home-made modules

• The international standard provides:

– Detailed mechanical specifications

– Detailed electrical specifications

• Components – mostly commercial:

– Crate providing power, cooling, monitoring

– 21 numbered slots

– One or more controllers (one in slot 1)• Typically a single-board computer

– Backplane to interconnect modules

– Slave modules – detector readout,counters – these can be home made

Norman Gee - Computers interacting with Hardware 15

Page 16: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

The interface from Computer … to VME

• VME users generally have a singleboard computer in the crate

• Most VME single board computersuse the Tundra “Universe” chipto link to VME

• Connects to the CPU via PCI bus

– R/W cycles (address, data)

• Two connections/maps involved:

– CPU virtual to physical

– PCI (physical) to VME

• CPU read/write instructionstranslate directly to PCI cyclesand thence to VME cycles

Norman Gee - Computers interacting with Hardware 16

VP/CP1/Pxx © Concurrent Technologies

Page 17: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VMEbus – Backplane Signal summary

• Like Motorola 68000 (~ 1980 CPU chip) signals, extended into a bus, grown to 32 bits– Handshake protocol – dialogue between Master and Slave

• Backplane connectors carry the same signals on the same connector pins in each slot– Most signals are bussed; a few are daisy-chained; a few are special– Signals are +5V or 0V (lower voltages were introduced a few years ago, they are not

in common use) – Normally +5V = logic “1”, but “*” in a signal name means +5V = logic “0”

• Data transfer – 32 data lines D31 – D0;– 31 address lines A31-A1(!) + DS0* & DS1* + LWORD* + AM5-AM0 ;– AS*, (DS0*, DS1*), BERR*,DTACK*, WRITE* plus others in VME64

• Arbitration – 14 signals. Determine which module becomes master and when

• Priority interrupts – 10 signals

• Utility bus – SYSCLK*, SYSRESET*, SYSFAIL*, ACFAIL*, plus others in VME64

Norman Gee - Computers interacting with Hardware 17

Page 18: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VMEbus – data transfer

“Timing Diagram”

Norman Gee - Computers interacting with Hardware 18

Page 19: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Example: VME Write Cycle (excluding arbitration)

• Master:• Assert Address, AM Code (cycle type – e.g. 0x09 = A32, D32)• Assert WRITE*, LWORD*• Assert AS*• Assert Data• Assert DS*

• Slave:• Inspect Address & AM Code• Capture Address & Data• Assert DTACK*

• Master:• Remove Address, AM & AS*• Remove Data & DS*

• Slave:• Remove DTACK*

• There are many other types of cycle – A16, A24, A32, A64, + D8, D16, D32, D64

Norman Gee - Computers interacting with Hardware 19

Page 20: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Overview of the Universe(“Tundra Universe”, that is)

• Manual has 467 pages!!

• Only referenced here to complete the story

• Three main sets of functions to support CPU as

– a VME Master (computer-initiated cycles)

• The normal case

– a VME Slave (another VME module reads or writes into our computer)

• The other VME module is probablyanother computer!!

• To avoid unless utterly essential

– an Interrupt handler

• Quite often needed

• Very briefly discussed later

Norman Gee - Computers interacting with Hardware 20

Page 21: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Universe (i.e. computer) as VME MasterVirtual Address Space

Address pointer (32 bits)

VPN1 VPN2 Offset

Physical Page No Offset

Physical Address Space

Page Directory

12 bits

10 bits

Page Tables

10 bits

PDBRP

0123

1

0

3

2n

n

SpecialSpecial

3Physical

PCI

VME A16 addr:position in "A16" space

VME A24 addr:position in "A24" space

Universe "images"(Universe-I has 4,Universe-II has 8)

VME addr = PCI addr + offset [31:12].A16, A24, A32, CR/CSR,..

Image Size, VME_Base and offset,addressing mode all programmable.

21

0

Memory

Specialimage

BIOS etc

BIOS etc

VME

Norman Gee - Computers interacting with Hardware 21

Page 22: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Another pause…

• VME is an international standard covering electrical and mechanical details

– There are many commercial modules around, institutes commonly make their own as well

• The protocol involves a handshake between AS*, DS(0,1)* and DTACK*

– Every cycle has a defined master and slave (and the controller)

• Interface hardware maps VME addresses into physical address space

– … looking like memory. An application may need several maps

• The computer’s memory management tables must map the hardware into virtual address space

– … so that your software can see it

• Now your software is talking to the hardware. The next section is about how to be fast

Norman Gee - Computers interacting with Hardware 22

Page 23: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Direct Memory Access - DMA

• Data collection usually involves reading a block of data into computer memory:for (i=0; i<ncycles; i++) { Q: Could I code this to run

faster?? *destination++ = *source++; }

• This is slow. Most PCI interfaces have DMA hardware to do this job faster– The CPU sets up the details of the multi-cycle transfer, then starts it– Each individual VME cycle is done by the DMA (the target module can’t tell)– Resulting data is written directly to physical computer memory– At the end, an interrupt may be generated, or the software can ask

“Finished?”• What does the DMA hardware need to know?

– First source address (in VME address space); Type of VME cycle to do;– First destination address (in computer PHYSICAL memory)– End Condition (e.g. number of bytes to transfer)

• The PCI bus is optimised for DMA traffic – the addresses are sent once per block not once per word. How about an optimised version of the VME protocol…

Norman Gee - Computers interacting with Hardware 23

Page 24: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VMEbus block transfers (MBLT - new in VME64)

• A fast use of VME, for DMA transfers only

• Different master-slave contract, indicated by a different AM Code (e.g. 0x08)

• Address sent only once

– then incremented internally by Master & Slave after each data transfer

• Data and address lines all used for data transfer

• No re-arbitration for bus mastership between cycles

Norman Gee - Computers interacting with Hardware 24

Page 25: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VME Block Transfers

• Many people use the terms DMA and Block Transfer as synonyms

• They are NOT

• DMA is a way of moving data to/from memory without involving the CPU

• Block Transfer uses a different type of VME cycle to move data faster

• >> If you specify modules, be clear about what you mean

– Making a module DMA-compliant needs no extra work. Making it Block-Transfer compliant may be quite hard

• If you need to execute a sequence of DMA operations, you can set up a “DMA Chain” – a data structure with a list of the operations. The controller can execute the complete list without CPU intervention. See the backup slides

Norman Gee - Computers interacting with Hardware 25

Page 26: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VME64 and extensions (VME64x, VME64xP)

• New cycle types allow for 40- or 64-bit addresses by borrowing some of the data lines

– The Address Modifier (AM) codes tell the slave what is happening

– Not all slaves support A40 or A64 addresses

• 64-bit data transfer (“MBLT”) is possible using D32, A31, & LWORD lines

– 64-bit data can’t be sent while the address lines are in use

• 2eVME transfers capture address or data on each transition of strobes

• 160 Mbytes/sec is claimed for latest VME extensions

– You will get ~few MB/s in programmed cycles, and 20-40 MB/s with DMA

– Getting higher speeds needs great care (make sure the specifications say what speed is needed)

Norman Gee - Computers interacting with Hardware 26

Page 27: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Summary so far

• There are several ways to make VME go faster.

– Being fast (i.e. > ~20 MB/s) is demanding

• DMA issues identical VME cycles, but without the CPU

– Cycles are more frequent, PCI traffic is in blocks

• Block transfers use DMA with different VME protocols

– Address sent only once on VMEbus. Faster than bare DMA

– Can use wider data in this mode

• Chained DMA joins a sequence of DMA transfers together as one transaction

• Next: Interrupts and Errors

Norman Gee - Computers interacting with Hardware 27

Page 28: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Interrupts

• …are external signals which are usually asynchronous wrt the executing code

– e.g. System clock, keyboard key pressed, USB connector inserted

• Warning: understanding this in detail will take you deep into the heart of the CPU hardware, external programmable interrupt controller chip, and the operating system kernel (so not for today)

• Happily, most of the work has been done and is in the device drivers

• In summary:

– The interrupt arrives;

– The CPU saves context at the end of the current instruction

– Then finds out which device sent the interrupt and jumps to its driver code

– Driver code clears the interrupt then does something to tell software – wakes a sleeping process or sends a signal or sets a flag

• What to do has been prearranged between our software and the driver

– Control goes back to the system, which restores context and resumes previous work

Norman Gee - Computers interacting with Hardware 28

Page 29: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VME Interrupts (outline)

• A VME module wants to attract attention of CPU– Some condition satisfied – e.g. front panel input signal from scintillator, count

has reached a preset value,…• Module pulls one if the 7 interrupt request (IRQ*) lines to 0V (i.e. logic 1)• Responding, the universe chip becomes VME bus master

– Universe chip issues a “Status/ID” read request• The interrupting VME Module responds with interrupt vector (normally 8 bits)

– which the Universe stores internally in a PCI-readable register.• Universe generates PCI interrupt (hardware signal) • CPU suspends current work, processes the interrupt, calls VME Driver Interrupt

handler code, then eventually resumes the previous work it was doing• VME interrupt handler reads vector inside the Universe

– Vector is used to identify target process, to which a Linux signal is sent• The application’s signal handler clears the module interrupt

Norman Gee - Computers interacting with Hardware 29

Page 30: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

VME interrupt caveats

• The Status/ID read cycle uses the special VME IACK* line

– This is a daisy-chain between slots, not a bus

– Jumpers must be installed to bridge empty slots between the interrupting module and the crate master

• Failure to do this will cause a system hang – the interrupt can’t be processed or cleared. So put the interrupting module as near to the CPU as possible

• Think carefully about interrupts vs polling

• The interrupt vector will be set by jumpers, switches or a register on the module

– Make sure your documentation fully describes the procedure to replace a broken module (same slot, copy the jumper settings) or to replace a crate (same crate backplane jumper settings)

• If you are very time-critical, prepare the DMA before the interrupt arrives

– Then just start it when your event is ready to read out

Norman Gee - Computers interacting with Hardware 30

Page 31: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Error Detection and Handling

• VME doesn’t have any checking that the data and address arrive correctly

– But when properly set up, corrupt data or addresses are very rare

– If you need high-reliability transfers, structure the data accordingly• e.g. include parity or crc fields in chunks of readout data

• A very common error is an attempt to address a missing module

– A normal cycle is terminated by the slave generation of DTACK*. If there is no slave, there’s no DTACK* - the VME cycle continues for ever

– To avoid this, there is a timer in the VME bus controller. Once the VME cycle has become too long (typically 64s), it asserts BERR* - “Bus Error”

– VME master must now aborts the cycle

– If the master is a computer interface, it will now raise an interrupt

– Interrupt handler can throw an exception which you can catch

Norman Gee - Computers interacting with Hardware 31

Page 32: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Bus error handling – code example

Your C++ code should use try/catch:

long value;

volatile long *myVmeRegister = {some address}; (Why volatile?)

try {

value = *myVmeRegister;

cout << “ I read value: “ << value << std::eol;

}

catch (BusError& error) {

std::cout << “ Bus error – myVmeRegister doesn’t respond.” << std:: eol;

}

• If you don’t include a try block, your program will be aborted

• try is not in standard c, look up longjmp/setjmp

Norman Gee - Computers interacting with Hardware 32

Page 33: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

The Last Pause…

• Handling VME interrupts needs attention to detail, but most of the work had been done for you in the VME device drivers

• Handling VME bus errors is normal daily work for everyone in the field. Don’t try to avoid the try blocks, you’ll live to regret it

• Questions?

Norman Gee - Computers interacting with Hardware 33

Page 34: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Practical Hints and Tips

• Take scope shots of signals in the working system so you know want to expect

• Obtain (or write) a general purpose VME exerciser software tool

– It is essential to be able to scan address space for modules, issue single read or write cycles, by hand, etc

• Use only 16-bit or only 32-bit integers unless other formats are essential

• If you make your own modules:

– Ask your engineers to add scope test points for VME signals• At least AS*, DS0*,DS1*, DTACK*, D0, board select

– Ask for a “board-select” light (to show when you are addressing the module)

– Ask your engineers to obey the VME spec fully – it’ll bite you later otherwise

• In C/C++, declare hardware registers “volatile” to prevent the compiler from optimising them away

Norman Gee - Computers interacting with Hardware 34

Page 35: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Hints and Tips (2)

• Buy a VME extender module – use it to access module internals and VME bus signals for diagnostics – and a VME Bus Display Module

Norman Gee - Computers interacting with Hardware 35

Page 36: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Hints and Tips (3)

• Be aware of…

backplane jumpers old-style backplanes with bars in the J0 position

Note: Check if crates and modules use 3-row or 5-row connectors

BG0-3

IACK*

Norman Gee - Computers interacting with Hardware 36

Page 37: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

• The old module will fit an old crate backplane. The new module will not.

Old module (VME32) New module (VME64)

• …but both will work in a VME64 crate

Hints and Tips (4)

Norman Gee - Computers interacting with Hardware 37

Page 38: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Hints and Tips (5)

• Store unused VME modules upside-down in a crate, so they can’t be pushed part-way into the backplane

• *** Don’t use the front panel screws to pull a module into a crate ***

• Observe antistatic precautions

• On holiday, learn how to use alogic analyser

Norman Gee - Computers interacting with Hardware 38

Page 39: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Postscript - xTCA

• The HEP world is talking about telecommunication architecture (ATCA, TCA) as the next crate standard. It is not yet clear how well it fits our needs

• Good: Detailed spec includes mechanics, cooling, live insertion

• Good: Very fast backplane, high-speed transfers between modules

– But BAD: backplane topologies may not suit our needs

• Bad: Very noisy; 48v power needs extra care; some module handles break easily; dangerous metal spikes on backplane

• Warning: designing modules to exploit the multi-Gigabit connections needs specialist engineering skills. These are not yet widely available in HEP institutes

• Conclusion: watch this space

Norman Gee - Computers interacting with Hardware 39

Page 40: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

References

• The VMEbus Handbook, by Wade Peterson, Published by VMEbus International Trade Association (VITA), from https://www.vita.com/online-store.html

• Tundra Universe Specification, at http://www.tundra.com/products.aspx?id=1643

• American National Standard for VME 64 Extensions (i.e. VME64x), ANSI/VITA 1.1-1997, from VITA as above

• American National Standard for VME 64 Extensions for Physics and Other Applications (i.e.VME64xP), ANSI/VITA 23-1998, from VITA as above (as PDF)

• PCI – introductory material in Wikipedia

• RAL has occasionally run a 1-2 day VME course

Norman Gee - Computers interacting with Hardware 40

Page 41: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Backup Slides

Norman Gee - Computers interacting with Hardware 41

Page 42: RAL-PPD Academic Training 2011-2012 Computer – Hardware Interactions (with emphasis on VME) 1-Feb-2012 Norman Gee.

Chained DMA

• The DMA paradigm unlocks several tricks to go much faster• Chained DMA is useful because reading several modules one after another is very

common. To use it:• Set up a linked list in memory, containing command packets for transactions to be done:

– Read 100 words from module 1 (at addr 0x123400, A32, D32, AM=0x09);– Then 80 words from module 2 (somewhere else in VME space);– etc. The last command packet has an “end” marker.

• Each entry in the list has all the info to set up the DMA for one contiguous transfer• Hand the address of the list to the DMA controller, say GO

– The DMA processes the complete list as one transaction

• During disk swapping and paging, the same idea is used to transfer data between physically discontiguous memory pages and disk blocks (“scatter-gather”)

Norman Gee - Computers interacting with Hardware 42