<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://daq00.triumf.ca/DaqWiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cpearson</id>
	<title>DaqWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://daq00.triumf.ca/DaqWiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cpearson"/>
	<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php/Special:Contributions/Cpearson"/>
	<updated>2026-04-12T07:27:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VT4_info&amp;diff=4064</id>
		<title>VT4 info</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VT4_info&amp;diff=4064"/>
		<updated>2018-07-08T03:16:15Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-VT4 - 4-channel timestamp module using the VME-IO32 board ==&lt;br /&gt;
&lt;br /&gt;
 UPDATE: July 2018 - some changes were made to operation ...&lt;br /&gt;
 Time starts at first cycle pulse after reset, and then runs continuously&lt;br /&gt;
 Gates are counted and written in place of cycle counter on gate-rise/fall&lt;br /&gt;
 Gate-count resets to zero at start of each new cycle&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x0003C || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00040 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00044 || Tstamp || R || Firmware Timestamp&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x00048 || Nwords || R || Data Words available&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x0004C || Data_Low || R || Data lower half [bits 31:0]&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00050 || Data_Hi || R || Data upper half [bits 63:32] *and select nextword*&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 8 bits auto-clear after a few clocks, bits 8, 9 indicate databuffer empty/full&lt;br /&gt;
the other bits are currently unused and retain whatever is written to them&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Reset || W || autocleared to zero&lt;br /&gt;
|-&lt;br /&gt;
|1-7|| unused || W || autocleared to zero&lt;br /&gt;
|-&lt;br /&gt;
|8|| Empty|| R || Data Buffer Empty&lt;br /&gt;
|-&lt;br /&gt;
|9|| Full || R ||  Data Buffer Full&lt;br /&gt;
|-&lt;br /&gt;
|10-31|| unused || R/W || unused&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
reset bit: Writing 1 here resets the module to powerup state.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
inputs 1 to 6 are used&lt;br /&gt;
&lt;br /&gt;
inputs 1-4 are tdc inputs&lt;br /&gt;
input 6 is  tdc-gate&lt;br /&gt;
input 5 is &amp;quot;new-cycle&amp;quot;&lt;br /&gt;
&lt;br /&gt;
at start of run, the module should be reset&lt;br /&gt;
&lt;br /&gt;
cycles are counted, timestamps reset on first tdc-gate of each cycle&lt;br /&gt;
tdc inputs are only counted during tdc-gates&lt;br /&gt;
(tdc-gates are not counted)&lt;br /&gt;
&lt;br /&gt;
data words are written to buffer on each: cycle, tdc-gate-rise, tdc-gate-fall, tdc-input[if gate high]&lt;br /&gt;
&lt;br /&gt;
data words are all 64bits with same format (from msb to lsb) ...&lt;br /&gt;
   [6bit id, 10bit cycle-count, 48bit timestamp]&lt;br /&gt;
&lt;br /&gt;
6 id bits are cycle,gaterise,ch1-4 [tdc-gate-fall words will have no id bits set]&lt;br /&gt;
&lt;br /&gt;
as the module is set up currently, if inputs/cycle/tdc-gate occur simultaneously, only one data word will be produced, but it will have all relevant id bits set.&lt;br /&gt;
&lt;br /&gt;
Read data low half first, then upper half, as reading upper half moves to next word in buffer.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VT4_info&amp;diff=4063</id>
		<title>VT4 info</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VT4_info&amp;diff=4063"/>
		<updated>2018-05-31T01:05:57Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-VT4 - 4-channel timestamp module using the VME-IO32 board ==&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x0003C || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00040 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00044 || Tstamp || R || Firmware Timestamp&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x00048 || Nwords || R || Data Words available&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x0004C || Data_Low || R || Data lower half [bits 31:0]&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00050 || Data_Hi || R || Data upper half [bits 63:32] *and select nextword*&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 8 bits auto-clear after a few clocks, bits 8, 9 indicate databuffer empty/full&lt;br /&gt;
the other bits are currently unused and retain whatever is written to them&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Reset || W || autocleared to zero&lt;br /&gt;
|-&lt;br /&gt;
|1-7|| unused || W || autocleared to zero&lt;br /&gt;
|-&lt;br /&gt;
|8|| Empty|| R || Data Buffer Empty&lt;br /&gt;
|-&lt;br /&gt;
|9|| Full || R ||  Data Buffer Full&lt;br /&gt;
|-&lt;br /&gt;
|10-31|| unused || R/W || unused&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
reset bit: Writing 1 here resets the module to powerup state.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
inputs 1 to 6 are used&lt;br /&gt;
&lt;br /&gt;
inputs 1-4 are tdc inputs&lt;br /&gt;
input 6 is  tdc-gate&lt;br /&gt;
input 5 is &amp;quot;new-cycle&amp;quot;&lt;br /&gt;
&lt;br /&gt;
at start of run, the module should be reset&lt;br /&gt;
&lt;br /&gt;
cycles are counted, timestamps reset on first tdc-gate of each cycle&lt;br /&gt;
tdc inputs are only counted during tdc-gates&lt;br /&gt;
(tdc-gates are not counted)&lt;br /&gt;
&lt;br /&gt;
data words are written to buffer on each: cycle, tdc-gate-rise, tdc-gate-fall, tdc-input[if gate high]&lt;br /&gt;
&lt;br /&gt;
data words are all 64bits with same format (from msb to lsb) ...&lt;br /&gt;
   [6bit id, 10bit cycle-count, 48bit timestamp]&lt;br /&gt;
&lt;br /&gt;
6 id bits are cycle,gaterise,ch1-4 [tdc-gate-fall words will have no id bits set]&lt;br /&gt;
&lt;br /&gt;
as the module is set up currently, if inputs/cycle/tdc-gate occur simultaneously, only one data word will be produced, but it will have all relevant id bits set.&lt;br /&gt;
&lt;br /&gt;
Read data low half first, then upper half, as reading upper half moves to next word in buffer.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VT4_info&amp;diff=4062</id>
		<title>VT4 info</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VT4_info&amp;diff=4062"/>
		<updated>2018-05-31T01:03:53Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: New page: == VME-VT4 - 4-channel timestamp module using the VME-IO32 board ==  === VME interface ===  VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address. ...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-VT4 - 4-channel timestamp module using the VME-IO32 board ==&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x0003C || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00040 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00044 || Tstamp || R || Firmware Timestamp&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x00048 || Nwords || R || Data Words available&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x0004C || Data_Loq || R || Data lower half [bits 31:0]&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00050 || Data_Hi || R || Data upper half [bits 63:32]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 8 bits auto-clear after a few clocks, bits 8, 9 indicate databuffer empty/full&lt;br /&gt;
the other bits are currently unused and retain whatever is written to them&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Reset || W || autocleared to zero&lt;br /&gt;
|-&lt;br /&gt;
|1-7|| unused || W || autocleared to zero&lt;br /&gt;
|-&lt;br /&gt;
|8|| Empty|| R || Data Buffer Empty&lt;br /&gt;
|-&lt;br /&gt;
|9|| Full || R ||  Data Buffer Full&lt;br /&gt;
|-&lt;br /&gt;
|10-31|| unused || R/W || unused&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
reset bit: Writing 1 here resets the module to powerup state.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
inputs 1 to 6 are used&lt;br /&gt;
&lt;br /&gt;
inputs 1-4 are tdc inputs&lt;br /&gt;
input 6 is  tdc-gate&lt;br /&gt;
input 5 is &amp;quot;new-cycle&amp;quot;&lt;br /&gt;
&lt;br /&gt;
at start of run, the module should be reset&lt;br /&gt;
&lt;br /&gt;
cycles are counted, timestamps reset on first tdc-gate of each cycle&lt;br /&gt;
tdc inputs are only counted during tdc-gates&lt;br /&gt;
(tdc-gates are not counted)&lt;br /&gt;
&lt;br /&gt;
data words are written to buffer on each: cycle, tdc-gate-rise, tdc-gate-fall, tdc-input[if gate high]&lt;br /&gt;
&lt;br /&gt;
data words are all 64bits with same format (from msb to lsb) ...&lt;br /&gt;
   [6bit id, 10bit cycle-count, 48bit timestamp]&lt;br /&gt;
&lt;br /&gt;
6 id bits are cycle,gaterise,ch1-4 [tdc-gate-fall words will have no id bits set]&lt;br /&gt;
&lt;br /&gt;
as the module is set up currently, if inputs/cycle/tdc-gate occur simultaneously, only one data word will be produced, but it will have all relevant id bits set.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4139</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4139"/>
		<updated>2013-02-22T19:21:11Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount [For VCO this parameter is: PostScale K=2 Yes/No]&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
Examples ...&lt;br /&gt;
   For Fin = 20Mhz [defaults settings on pwerup]&lt;br /&gt;
   Fvco=1200,K=2 =&amp;gt; 600Mhz .. M=30, N=1(Bypassed), C0=6(3+3) Fin=20Mhz =&amp;gt; C0=100Mhz&lt;br /&gt;
&lt;br /&gt;
   For Fin=100Mhz [and M=30,N=1,C0=6] Need to Change N to 5 ...&lt;br /&gt;
   Write:   0x00000305   0  0x01000205  0  0x05000105      0    0x04000005         0  0x3          0&lt;br /&gt;
            type=0,hi=3     type=0,lo=2    type=0,mode=odd      type=0,bypass=no      Reconfigure&lt;br /&gt;
&lt;br /&gt;
   Change back from 100 to 20 - need to change N to bypassed ...&lt;br /&gt;
   write:   0x04000105        0    0x3          0&lt;br /&gt;
            type=0,bypass=no       Reconfigure&lt;br /&gt;
&lt;br /&gt;
   For Deap 62.5 Mhz (20*25/8)  Fvco=1000,k=2=&amp;gt;500 M=8 N=1 C0=5 gives 100Mhz&lt;br /&gt;
                                Fvco=1000,k=2=&amp;gt;500 M=8 N=1 C0=8 gives 62.5Mhz&lt;br /&gt;
&lt;br /&gt;
**Note - to help debug clock setting problems the internal clock can be viewed on ppg output #1 (and the 20 Mhz internal clock on output #0), if the test-mode bit is set in the CSR [bit 4].  It is then possible to check the ppg clock is locked and at the correct frequency (100Mhz), and see the relation between the external and internal clocks.&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4138</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4138"/>
		<updated>2013-02-21T00:01:26Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount [For VCO this parameter is: PostScale K=2 Yes/No]&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
Examples ...&lt;br /&gt;
   For Fin = 20Mhz [defaults settings on pwerup]&lt;br /&gt;
   Fvco=1200,K=2 =&amp;gt; 600Mhz .. M=30, N=1(Bypassed), C0=6(3+3) Fin=20Mhz =&amp;gt; C0=100Mhz&lt;br /&gt;
&lt;br /&gt;
   For Fin=100Mhz [and M=30,N=1,C0=6] Need to Change N to 5 ...&lt;br /&gt;
   Write:   0x00000305   0  0x01000205  0  0x05000105      0    0x04000005         0  0x3          0&lt;br /&gt;
            type=0,hi=3     type=0,lo=2    type=0,mode=odd      type=0,bypass=no      Reconfigure&lt;br /&gt;
&lt;br /&gt;
   Change back from 100 to 20 - need to change N to bypassed ...&lt;br /&gt;
   write:   0x04000105        0    0x3          0&lt;br /&gt;
            type=0,bypass=no       Reconfigure&lt;br /&gt;
&lt;br /&gt;
   For Deap 62.5 Mhz (20*25/8)  Fvco=1000,k=2=&amp;gt;500 M=8 N=1 C0=5&lt;br /&gt;
&lt;br /&gt;
**Note - to help debug clock setting problems the internal clock can be viewed on ppg output #1 (and the 20 Mhz internal clock on output #0), if the test-mode bit is set in the CSR [bit 4].  It is then possible to check the ppg clock is locked and at the correct frequency (100Mhz), and see the relation between the external and internal clocks.&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4137</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4137"/>
		<updated>2013-02-20T23:59:32Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount [For VCO this parameter is: PostScale K=2 Yes/No]&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
Examples ...&lt;br /&gt;
   For Fin = 20Mhz [defaults settings on pwerup]&lt;br /&gt;
   Fvco=1200,K=2 =&amp;gt; 600Mhz .. M=30, N=1(Bypassed), C0=6(3+3) Fin=20Mhz =&amp;gt; C0=100Mhz&lt;br /&gt;
&lt;br /&gt;
   For Fin=100Mhz [and M=30,N=1,C0=6] Need to Change N to 5 ...&lt;br /&gt;
   Write:   0x00000305   0  0x01000205  0  0x05000105      0    0x04000005         0  0x3          0&lt;br /&gt;
            type=0,hi=3     type=0,lo=2    type=0,mode=odd      type=0,bypass=no      Reconfigure&lt;br /&gt;
&lt;br /&gt;
   Change back from 100 to 20 - need to change N to bypassed ...&lt;br /&gt;
   write:   0x04000105        0    0x3          0&lt;br /&gt;
            type=0,bypass=no       Reconfigure&lt;br /&gt;
&lt;br /&gt;
   For Deap 62.5 Mhz (20*25/8)  Fvco=1000,k=2=&amp;gt;500 M=8 N=1 C0=5&lt;br /&gt;
&lt;br /&gt;
**Note - to help debug clock setting problems the internal clock can be viewed on ppg output #1 (and the 20 Mhz internal clock on output #0), if Led-Control bit is set in the CSR [bit 4]&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4136</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4136"/>
		<updated>2013-02-20T23:56:53Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount [For VCO this parameter is: PostScale K=2 Yes/No]&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
Examples ...&lt;br /&gt;
   For Fin = 20Mhz [defaults settings on pwerup]&lt;br /&gt;
   Fvco=1200,K=2 =&amp;gt; 600Mhz .. M=30, N=1(Bypassed), C0=6(3+3) Fin=20Mhz =&amp;gt; C0=100Mhz&lt;br /&gt;
&lt;br /&gt;
   For Fin=100Mhz [and M=30,N=1,C0=6] Need to Change N to 5 ...&lt;br /&gt;
   Write:   0x00000305   0  0x01000205  0  0x05000105      0    0x04000005         0  0x3          0&lt;br /&gt;
            type=0,hi=3     type=0,lo=2    type=0,mode=odd      type=0,bypass=no      Reconfigure&lt;br /&gt;
&lt;br /&gt;
   Change back from 100 to 20 - need to change N to bypassed ...&lt;br /&gt;
   write:   0x04000105        0    0x3          0&lt;br /&gt;
            type=0,bypass=no       Reconfigure&lt;br /&gt;
&lt;br /&gt;
   For Deap 62.5 Mhz (20*25/8)  Fvco=1000,k=2=&amp;gt;500 M=8 N=1 C0=5&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4135</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4135"/>
		<updated>2013-02-20T23:47:55Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount [For VCO this parameter is: PostScale K=2 Yes/No]&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
Examples ...&lt;br /&gt;
   For Fin = 20Mhz [defaults settings on pwerup]&lt;br /&gt;
   Fvco=1200,K=2 =&amp;gt; 600Mhz .. M=30, N=1(Bypassed), C0=6(3+3) Fin=20Mhz =&amp;gt; C0=100Mhz&lt;br /&gt;
&lt;br /&gt;
   For Fin=100Mhz [and M=30,N=1,C0=6] Need to Change N to 5 ...&lt;br /&gt;
   Write:   0x00000305   0  0x01000205  0  0x05000105      0    0x04000005         0  0x3          0&lt;br /&gt;
            type=0,hi=3     type=0,lo=2    type=0,mode=odd      type=0,bypass=no      reconfigure&lt;br /&gt;
&lt;br /&gt;
   Change back from 100 to 20 - need to change N to bypassed ...&lt;br /&gt;
   write:&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4134</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4134"/>
		<updated>2013-02-20T23:46:50Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount [For VCO this parameter is: PostScale K=2 Yes/No]&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
Examples ...&lt;br /&gt;
   For Fin = 20Mhz [defaults settings on pwerup]&lt;br /&gt;
   Fvco=1200,K=2 =&amp;gt; 600Mhz .. M=30, N=1(Bypassed), C0=6(3+3) Fin=20Mhz =&amp;gt; C0=100Mhz&lt;br /&gt;
&lt;br /&gt;
   For Fin=100Mhz [and M=30,N=1,C0=6] Need to Change N to 5 ...&lt;br /&gt;
   Write:   0x00000305   0  0x01000205  0  0x05000105      0    0x04000005&lt;br /&gt;
            type=0,hi=3     type=0,lo=2    type=0,mode=odd      type=0,bypass=no&lt;br /&gt;
&lt;br /&gt;
   Change back from 100 to 20 - need to change N to bypassed ...&lt;br /&gt;
   write:&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4133</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4133"/>
		<updated>2013-02-20T23:34:18Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
Examples ...&lt;br /&gt;
   For Fin = 20Mhz [defaults settings on pwerup]&lt;br /&gt;
   if parameters have been changed - need to set&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4132</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4132"/>
		<updated>2013-02-20T23:32:32Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
phasestep is applied immediately (to clocks selected by PhaseCounterSelect), and does not require a reconfiguration or reset.&lt;br /&gt;
&lt;br /&gt;
The parameters below need to be written (with writeparameter=1), and then require a reconfiguration to be applied.&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
Clock frequencies are defined by ...&lt;br /&gt;
   VCO Frequency = Fin * M/N&lt;br /&gt;
   The individual clock outputs [clock0-4] are given by ... VCO / C0-C4&lt;br /&gt;
&lt;br /&gt;
   Each of M,N,C0-C4 are the sum of a high and low count.&lt;br /&gt;
   Note - can get 50% duty cycle with odd count by setting mode=odd with high=low+1&lt;br /&gt;
   Each counter can be bypassed by setting bypass=1 (=&amp;gt; Scale=1)&lt;br /&gt;
&lt;br /&gt;
Limits etc ...&lt;br /&gt;
   Fin  =   5 -  472 Mhz&lt;br /&gt;
   Fvco = 600 - 1300 Mhz&lt;br /&gt;
   Lock Time &amp;lt; 1ms&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4131</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4131"/>
		<updated>2013-02-20T23:22:30Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4: 1=up,0=Down]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
PhaseCounterSelect ...&lt;br /&gt;
   0 =&amp;gt; All Clocks&lt;br /&gt;
   1 =&amp;gt; M ?&lt;br /&gt;
   2-6 =&amp;gt; Clock 0-4&lt;br /&gt;
&lt;br /&gt;
Counter-Type ...&lt;br /&gt;
   0: N&lt;br /&gt;
   1: M&lt;br /&gt;
   2: Cp/LF&lt;br /&gt;
   3: VCO&lt;br /&gt;
   4-8: Clock 0-4&lt;br /&gt;
   9-D: Clock 5-9 (Stratix Only)&lt;br /&gt;
   E-F: Invalid&lt;br /&gt;
&lt;br /&gt;
Counter-Parameter ...&lt;br /&gt;
   0: HighCount&lt;br /&gt;
   1: LowCount&lt;br /&gt;
   4: Bypass&lt;br /&gt;
   5: Mode Odd/Even&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4130</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4130"/>
		<updated>2013-02-20T23:06:53Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Clock Control (0x00030) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Control Trigger&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Control Trigger Bit [bit 0] enables the four control signals in bits 1,2,3,5, and needs to be toggled from off to on, to apply these 4 signals.&lt;br /&gt;
&lt;br /&gt;
On rising edge of control trigger ...&lt;br /&gt;
   Phasestep=1       =&amp;gt; clock phase is adjusted by 1 unit, in the direction selected by &amp;quot;Up/Down&amp;quot; [bit 4]&lt;br /&gt;
   Write Parameter=1 =&amp;gt; 9bit-Data, Counter-Type and Counter-Param are written into the PLL reconfiguration registers&lt;br /&gt;
   Reconfigure=1     =&amp;gt; PLL is reconfigured with the parameters currently in its reconfiguration registers&lt;br /&gt;
   PLL-Reset=1       =&amp;gt; PLL is reset&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4129</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4129"/>
		<updated>2013-02-20T22:48:33Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Registers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
Set PLL parameters applied to external clock input.  Default parameters are for 20Mhz External Clock, and multiply this by 5 to get 100Mhz ppg clock.&lt;br /&gt;
&lt;br /&gt;
Register Contents as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 30-28 || Bits 26-24 || Bits 23-20 || Bits 16-8 || Bit 5 || Bit 4 || Bit 3 || Bit 2 || Bit 1 || Bit 0&lt;br /&gt;
|-&lt;br /&gt;
| Phase Counter Select || Counter Parameter || Counter Type || 9 bit Data || PLL Reset || Up/Down || PhaseStep || Write Parameter || reconfigure || Unused?&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4128</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4128"/>
		<updated>2013-02-20T22:17:29Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Registers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00125] VME-PPG32 Rev2 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/158] Rev2 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [[Image:VME-PPG32 Rev2.pdf]] Rev2 board schematics, local copy&lt;br /&gt;
&lt;br /&gt;
VME-PPG32-IO32 firmware: (IO32 functions, no PPG functions)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 VME CPLD firmware: (VME address decoder)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
&lt;br /&gt;
VME-PPG32 firmware: (PPG function)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
* Rev1 and Rev2 boards: inputs are switchable between NIM and TTL (JMP3)&lt;br /&gt;
* Rev2 boards: outputs are switchable between NIM and TTL (SW1 micro switches)&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== Firmware update procedure ===&lt;br /&gt;
&lt;br /&gt;
(note1: right now the PPG firmware update procedure is unnecessary complicated because there is no ppg.pof file in the PPG firmware distribution version &amp;quot;1mar12&amp;quot; and the PPG firmware does not include the Altera active-serial programmer block.)&lt;br /&gt;
&lt;br /&gt;
(note2: VME-PPG32-IO32 firmware (sof file) is required to update the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
* obtain the PPG firmware zip file (from http://daq-plone.triumf.ca/HR/VME/ppg32)&lt;br /&gt;
* extract the ppg.jic file&lt;br /&gt;
* obtain the VME-PPG32-IO32 sof file (VME-PPG32.sof) from https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log&lt;br /&gt;
&lt;br /&gt;
==== Update using USB-Blaster and jic file ====&lt;br /&gt;
&lt;br /&gt;
* use Quartus programmer to burn the jic file through the EP3 active-serial flash loader:&lt;br /&gt;
* start Quartus programmer (tools-&amp;gt;programmer)&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot; - EP3, EPM1270 and EPM3032A should be detected&lt;br /&gt;
* attach VME-PPG32.sof to the EP3 part (context menu &amp;quot;change file&amp;quot;)&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe that 2 &amp;quot;red&amp;quot; LEDs have turned on on the PPG board (40MHz clock on outputs 4 and 20).&lt;br /&gt;
* say &amp;quot;auto detect&amp;quot;&lt;br /&gt;
* an &amp;quot;EPCS16&amp;quot; part should show up attached to the EP3.&lt;br /&gt;
* attach ppg.jic to the EPCS16 part&lt;br /&gt;
* select &amp;quot;program&amp;quot;&lt;br /&gt;
* say &amp;quot;start&amp;quot;&lt;br /&gt;
* observe progress bar go from 0 to 100% in about 2 minutes.&lt;br /&gt;
* PPG firmware is now loaded into the board&lt;br /&gt;
* cycle the power on the board to reboot into the PPG firmware&lt;br /&gt;
* when running the PPG firmware, all LEDs are off after reboot.&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer ====&lt;br /&gt;
&lt;br /&gt;
(note: VME flash programmer interface does not work in ppg firmware version &amp;quot;1mar12&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
* obtain the latest copy of srunner_vme (follow instructions here [[VME-NIMIO32#Firmware_update_procedure]]) (srunner_vme.cxx svn rev 214 or newer for jic support)&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100024&lt;br /&gt;
* reboot the PPG&lt;br /&gt;
&lt;br /&gt;
(note: the above does not work: b) srunner_vme treats 0x10xxxx is an A24 address, but PPG firmware does not respond to A24 addresses; c) the active serial interface does not seem to work anyway)&lt;br /&gt;
&lt;br /&gt;
(note: the reboot function is not available in the PPG firmware)&lt;br /&gt;
&lt;br /&gt;
==== Update using VME flash programmer when running VME-PPG32-IO32 firmware ====&lt;br /&gt;
&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --read 0  ### to confirm VME-PPG32-IO32 firmware revision&lt;br /&gt;
* ./srunner_vme_gef.exe -program -16 ppg.jic 0x100020&lt;br /&gt;
* ./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot ### PPG will stop responding&lt;br /&gt;
* ./test_a32.exe 0x100000 ### should read 0x00000000 (NOT 0xFFFFFFFF)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0x00030 || clock Control || RW || Clock Control Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
===== Clock Control (0x00030) =====&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== Procedure for newly assembled board startup and test ===&lt;br /&gt;
&lt;br /&gt;
(note1: VME-PPG32-IO32 firmware is used to test the board)&lt;br /&gt;
&lt;br /&gt;
(note2: TTL inputs and outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note3: DAC outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
(note4: shorts between NIM outputs are not tested)&lt;br /&gt;
&lt;br /&gt;
* set VME address jumper A20-23 to &amp;quot;1&amp;quot;, jumpers A24-27 and A28-31 to &amp;quot;0&amp;quot;&lt;br /&gt;
* set inputs and outputs to &amp;quot;NIM&amp;quot; mode&lt;br /&gt;
* connect JTAG USB blaster&lt;br /&gt;
* power up the board (standalone or in a VME crate)&lt;br /&gt;
* start Quartus programmer&lt;br /&gt;
* select correct USB blaster&lt;br /&gt;
* run &amp;quot;auto detect&amp;quot;, 3 devices should be detected: EP3C20Q240 (Cyclone3 FPGA), EPM1270 (parallel flash loader CPLD), EPM3032AT44 (VME address decoder CPLD)&lt;br /&gt;
* flash the VME address decoder pof file into the EPM3032 part (get pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?view=log)&lt;br /&gt;
* (do not do this) flash the CFI parallel flash loader into the EPM1270 part (get pof file where?!?)&lt;br /&gt;
* load the VME-PPG32-IO32 firmware sof file into the EP3 part (get sof file here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.sof?view=log)&lt;br /&gt;
* run &amp;quot;vmescan_gef.exe&amp;quot;, it should detect the IO32 board at A24 VME address 0x00100000, data should correspond to the sof file revision date code&lt;br /&gt;
* confirm VME access LED is working (flashes during vme scan).&lt;br /&gt;
* confirm VME Data bus is okey: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --testbits 4&amp;quot;&lt;br /&gt;
* (do not do this) follow the firmware update instructions to flash the firmware pof file using the VME flash programmer at [[VME-NIMIO32#Firmware_update_procedure]] (get VME-PPG32-IO32 pof file from here: https://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1/VME-PPG32.pof?view=log)&lt;br /&gt;
* (do not do this) confirm FPGA reboot is working - &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --reboot&amp;quot; prints 0xFFFFFFFF on the second read of firmware revision&lt;br /&gt;
* test NIM inputs and LEDs: use NIM pulse generator or any NIM module inverted output, connect to each NIM input, observe that corresponding &amp;quot;green&amp;quot; LEDs is lighting up&lt;br /&gt;
* test NIM outputs and LEDs: &amp;quot;./test_VMENIMIO32_gef.exe --addr 0x100000 --nimout 3 1 --pulsenim&amp;quot;, observe all &amp;quot;red&amp;quot; LEDs are flashing, connect NIM outputs to NIM scaler, observe scaler counts at each LED flash&lt;br /&gt;
* load PPG firmware into the active serial flash (follow instructions here: [[#Update_using_VME_flash_programmer_when_running_VME-PPG32-IO32_firmware]]&lt;br /&gt;
* unplug the board from VME, wait 10 sec, plug it back in, confirm that it is detected by vmescan if running VME-PPG32-IO32 firmware or test_a32 or PPG test tools if running the PPG firmware (confirms the flash memory contents is good)&lt;br /&gt;
&lt;br /&gt;
=== VME-PPG32-IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run a special version of VME-NIMIO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the [[VME-NIMIO32]] documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4104</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4104"/>
		<updated>2012-03-03T00:06:31Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* CSR Register (0x00004) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is &amp;quot;good&amp;quot;    0= external clock not connected or is &amp;quot;bad&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 become output the internal PPG clock and actual clock PPG is using, respectively. If internal clock is set, inputs 1 and 2 output identical clocks. If external clock is set, and the external clock is &amp;quot;good&amp;quot;, input 1 will not change, but input 2 will show the external clock frequency.   &lt;br /&gt;
If Test-Mode bit is cleared, Normal Mode is enabled, where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk Good: If bit is set, external clock is connected to Nim_Input[3] and is &amp;quot;good&amp;quot;. LED 2 will be lit.  If clear, external clock is either not connected or is &amp;quot;bad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run the IO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the IO32 documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4103</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4103"/>
		<updated>2012-03-02T23:52:09Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* PPG characteristics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions                                     &lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input - see note 1)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Note 1 :&lt;br /&gt;
   Some modules allow an external clock frequency of 20-100MHz . Divide-downs must be programmed where external clock frequency is not 20MHz. &lt;br /&gt;
   Examples of divide-down programming is shown at end of this document.&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is good    0= external clock not connected or is bad&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 output the PPG clock and Ext. Clock.  Clear bit to enable Normal Mode where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk good: If bit is set, external clock is connected to Nim_Input[3] and is good. LED 2 will be lit.  If clear, external clock is either not connected or is bad.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run the IO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the IO32 documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4102</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4102"/>
		<updated>2012-03-02T23:46:49Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Test Software */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is good    0= external clock not connected or is bad&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 output the PPG clock and Ext. Clock.  Clear bit to enable Normal Mode where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk good: If bit is set, external clock is connected to Nim_Input[3] and is good. LED 2 will be lit.  If clear, external clock is either not connected or is bad.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 100MHz frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used with an external frequency input of 100MHz&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x00000305   # set hi counter to 3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x01000205   # set lo counter to 2&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x05000105   # set mode counter to odd &lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000005   # set counter bypass to 0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to set divide-downs for 10MHz  frequency  ====&lt;br /&gt;
&lt;br /&gt;
This would be used when returning to the internal frequency of 10MHz :&lt;br /&gt;
&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x04000105  # set counter bypass to 1&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x3         # reconfig clock&lt;br /&gt;
  vme_poke -a VME_A32UD -A 0x00100030 -d VME_D32 0x0         # prepare for next cmd&lt;br /&gt;
&lt;br /&gt;
=== IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run the IO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the IO32 documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4101</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4101"/>
		<updated>2012-03-02T23:39:41Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* CSR Register (0x00004) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk-Toggle || W || Toggles between PPG external and internal Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || 1=Ext-PPG Start 0=Int-PPG Start&lt;br /&gt;
|-&lt;br /&gt;
|3|| PPG-Reset || R/W || 1=Reset    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || 1=Test Mode    0=Normal operation&lt;br /&gt;
|-&lt;br /&gt;
|16|| Ext-Clk-Sel || R || 1= External clock is selected    0 = Internal clock selected&lt;br /&gt;
|-&lt;br /&gt;
|17|| Ext-Clk good || R || 1= External clock is connected and is good    0= external clock not connected or is bad&lt;br /&gt;
|-&lt;br /&gt;
|?-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing an edge here toggles the ppg logic between the internal and external CLK (connected to Nim_Input[3]). The VME interface always uses the internal clock.&lt;br /&gt;
Note that the correct divide-down must be programmed unless external clock is the same frequency (i.e. 10MHz) as internal clock.&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start. (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[4])&lt;br /&gt;
&lt;br /&gt;
Reset bit: Set bit to Reset PPG. Stops PPG pgm even if executing a long delay. Does NOT do a full reset to power-up condition. Bit must be cleared after Reset or module will not operate.&lt;br /&gt;
&lt;br /&gt;
Test-Mode bit: Set bit to enable Test Mode. When Test Mode is enabled, inputs 1 and 2 output the PPG clock and Ext. Clock.  Clear bit to enable Normal Mode where inputs 1 and 2 act as regular inputs.&lt;br /&gt;
&lt;br /&gt;
Ext-Clk-Sel: If bit is set, external clock is selected and LED 4 will be lit.  If clear, internal clock is selected&lt;br /&gt;
&lt;br /&gt;
Ext-Clk good: If bit is set, external clock is connected to Nim_Input[3] and is good. LED 2 will be lit.  If clear, external clock is either not connected or is bad.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
=== IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run the IO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the IO32 documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4100</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4100"/>
		<updated>2012-03-02T22:49:11Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Front Panel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   3 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   1 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (as labelled on front panel) ...&lt;br /&gt;
   4 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[2] status&lt;br /&gt;
   2 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
=== IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run the IO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the IO32 documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4099</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4099"/>
		<updated>2011-10-06T05:29:47Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Serial Number (0x00028) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00022] VME-PPG32 Rev0 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/projects/edevel00067] VME-PPG32 Rev1 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [https://edev.triumf.ca/documents/27] Rev0 board schematics on edev site&lt;br /&gt;
* [https://edev.triumf.ca/documents/111] Rev1 board schematics on edev site&lt;br /&gt;
* [[Image:VME-PPG32 Rev1.pdf]] Rev1 board schematics, local copy&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32-Rev0] Svn repository for VME-PPG32-Rev0 initial test firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/VME-NIMIO32/PPG32-Rev1] Svn repository for VME-PPG32-Rev1 firmware (IO32 function only, no PPG function)&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode] Svn repository for VME-PPG32 Rev0 and Rev1 VME address decoder CPLD (Altera EPM3032)&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== Onboard jumper settings ===&lt;br /&gt;
&lt;br /&gt;
* JMP1 - set to &amp;quot;INP&amp;quot; for input with 50 Ohm termination, set to &amp;quot;DAC&amp;quot; for DAC output&lt;br /&gt;
* JMP2 - set to &amp;quot;INP&amp;quot; same as JMP1&lt;br /&gt;
* JMP3 - set to &amp;quot;NIM&amp;quot; (pins 1-2) for NIM inputs or &amp;quot;TTL&amp;quot; (pins 2-3) for TTL inputs&lt;br /&gt;
* JMP4 - &amp;quot;MSEL1&amp;quot; jumper set to &amp;quot;ACT&amp;quot; for use with the active-serial flash&lt;br /&gt;
* IrqSel - leave open&lt;br /&gt;
* JTAG - leave open (not a jumper block!)&lt;br /&gt;
* SW1..3 - VME base address selectors (see below)&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or 0xdead&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (Left-Right, Top-Bottom) ...&lt;br /&gt;
   0 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   1 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   3 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (Left-Right, Top-Bottom) ...&lt;br /&gt;
   0 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
   2 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[3] status&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;br /&gt;
&lt;br /&gt;
=== IO32 firmware ===&lt;br /&gt;
&lt;br /&gt;
The VME-PPG32 board can run the IO32 firmware (subproject &amp;quot;PPG32-Rev1&amp;quot; of the VME-NIMIO32 firmware). For instructions, please refer to the IO32 documentation.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4090</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4090"/>
		<updated>2011-01-25T23:50:11Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* NIM Inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (Left-Right, Top-Bottom) ...&lt;br /&gt;
   0 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   1 - External Start (Not fully tested yet) Needs to stay high (low =&amp;gt; stop!)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   3 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (Left-Right, Top-Bottom) ...&lt;br /&gt;
   0 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
   2 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[3] status&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4089</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4089"/>
		<updated>2011-01-25T23:49:00Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* VME-PPG32 - pulse pattern generator VME FPGA board */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Front Panel ===&lt;br /&gt;
&lt;br /&gt;
==== NIM Inputs ====&lt;br /&gt;
&lt;br /&gt;
   The Input assignments are (Left-Right, Top-Bottom) ...&lt;br /&gt;
   0 - External Clock (20Mhz, internally scaled - 100Mhz)&lt;br /&gt;
   1 - External Start (Not fully tested yet)&lt;br /&gt;
   2 - Unassigned&lt;br /&gt;
   3 - Unassigned&lt;br /&gt;
&lt;br /&gt;
==== Input LEDs ====&lt;br /&gt;
&lt;br /&gt;
   The Input LED assignments are (Left-Right, Top-Bottom) ...&lt;br /&gt;
   0 - External Clock Good indicator (Lit =&amp;gt; Clock is good)&lt;br /&gt;
   1 - Program Running&lt;br /&gt;
   2 - Clock setting (Lit =&amp;gt; External Clk)&lt;br /&gt;
   3 - NimIn[3] status&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4088</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4088"/>
		<updated>2011-01-20T01:15:34Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Registers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4087</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4087"/>
		<updated>2011-01-16T19:31:20Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* c-shell script to run 2 nested loops */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4086</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4086"/>
		<updated>2011-01-16T19:31:02Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* c-shell script to run 2 nested loops */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
&lt;br /&gt;
   # dly4,loop4,dly3,loop6,dly2,end,end&lt;br /&gt;
   set inst=(                                                \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4085</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4085"/>
		<updated>2010-11-09T23:41:08Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* VME interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Output Inversion Mask (0x0001C) =====&lt;br /&gt;
32 individual inversion bits (1 per output) a 1 inverts the state of that output.&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x00020) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00024) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00028) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x0002C) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   set inst=( # dly4,loop4,dly3,loop6,dly2,end,end           \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4084</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4084"/>
		<updated>2010-11-09T23:34:08Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Registers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Inv_Mask || RW || Output Inversion Mask&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 0x0002C || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x0001C) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00020) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00024) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x00028) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   set inst=( # dly4,loop4,dly3,loop6,dly2,end,end           \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4083</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4083"/>
		<updated>2010-11-09T23:33:05Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* PPG characteristics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
   FPGA resource Usage : 1044 LE, 500 kbits Memory&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x0001C) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00020) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00024) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x00028) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   set inst=( # dly4,loop4,dly3,loop6,dly2,end,end           \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4082</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4082"/>
		<updated>2010-11-09T06:42:36Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* c-shell script to run 2 nested loops */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x0001C) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00020) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00024) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x00028) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   set inst=( # dly4,loop4,dly3,loop6,dly2,end,end           \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
   &lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4081</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4081"/>
		<updated>2010-11-09T06:42:13Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* VME-PPG32 - pulse pattern generator VME FPGA board */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x0001C) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00020) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00024) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x00028) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;br /&gt;
&lt;br /&gt;
=== Test Software ===&lt;br /&gt;
&lt;br /&gt;
==== c-shell script to run 2 nested loops ====&lt;br /&gt;
&lt;br /&gt;
   set dec_hex=( 0x0  0x1  0x2  0x3  0x4  0x5  0x6  0x7  \&lt;br /&gt;
                 0x8  0x9  0xa  0xb  0xc  0xd  0xe  0xf  \&lt;br /&gt;
                 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 \&lt;br /&gt;
                 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f \&lt;br /&gt;
                 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 )&lt;br /&gt;
   &lt;br /&gt;
   set inst=( # dly4,loop4,dly3,loop6,dly2,end,end           \&lt;br /&gt;
      0xff  0x00  0x4  0x100000   0x0   0x0   0x0  0x200004  \&lt;br /&gt;
      0x1   0x1   0x3  0x100000   0x0   0x0   0x0  0x200006  \&lt;br /&gt;
      0x2   0x2   0x2  0x100000   0x0   0x0   0x0  0x300000  \&lt;br /&gt;
      0x0   0x0   0x0  0x300000   0x0   0x0   0x0  0x000000  )&lt;br /&gt;
   &lt;br /&gt;
   set i=0&lt;br /&gt;
   set j=0&lt;br /&gt;
   while( $i &amp;lt; $#inst )&lt;br /&gt;
      @ j++; vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 $dec_hex[$j]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x0010000c -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100010 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100014 -d VME_D32 $inst[$i]&lt;br /&gt;
      @ i++; vme_poke -a VME_A32UD -A 0x00100018 -d VME_D32 $inst[$i]&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
   # start program (from addr 0)...&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100008 -d VME_D32 0x0&lt;br /&gt;
   vme_poke -a VME_A32UD -A 0x00100000 -d VME_D32 0x1&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4080</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4080"/>
		<updated>2010-11-09T06:36:33Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Address Register (0x00008) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address.  Also in test-Mode, the NIM/LED outputs follow the state of this register.&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x0001C) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00020) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00024) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x00028) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4079</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4079"/>
		<updated>2010-11-09T06:34:40Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* VME-PPG32 - pulse pattern generator VME FPGA board */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
=== VME interface ===&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Test Register (0x00000) =====&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
===== CSR Register (0x00004) =====&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
===== Address Register (0x00008) =====&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address&lt;br /&gt;
&lt;br /&gt;
===== Instruction Registers (0x0000C - 0x00018) =====&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
===== Firmware Version (0x0001C) =====&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
===== Serial Flash Control (0x00020) =====&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
===== Serial Number (0x00024) =====&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
===== hardware Type (0x00028) =====&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4078</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4078"/>
		<updated>2010-11-09T06:33:04Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* General characteristics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== PPG characteristics ====&lt;br /&gt;
&lt;br /&gt;
   4k words (128bit words) of program memory.&lt;br /&gt;
   256 entry stack.&lt;br /&gt;
   Halt/Continue/Loop/Subroutine/Branch instructions&lt;br /&gt;
   100Mhz clock (derived from either 50Mhz internal crystal or external 20Mhz clock input)&lt;br /&gt;
   fixed 3 clk per instruction plus 32bit delay individualy programmable for each instruction&lt;br /&gt;
&lt;br /&gt;
==== VME interface ====&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Test Register (0x00000) ===&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
=== CSR Register (0x00004) ===&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
=== Address Register (0x00008) ===&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address&lt;br /&gt;
&lt;br /&gt;
=== Instruction Registers (0x0000C - 0x00018) ===&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
=== Firmware Version (0x0001C) ===&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
=== Serial Flash Control (0x00020) ===&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
=== Serial Number (0x00024) ===&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
=== hardware Type (0x00028) ===&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4077</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4077"/>
		<updated>2010-11-09T06:28:15Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Instruction Registers (0x0000C - 0x00018) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== VME interface ====&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Test Register (0x00000) ===&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
=== CSR Register (0x00004) ===&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
=== Address Register (0x00008) ===&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address&lt;br /&gt;
&lt;br /&gt;
=== Instruction Registers (0x0000C - 0x00018) ===&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
   The instruction types are ...&lt;br /&gt;
   0 - Halt&lt;br /&gt;
   1 - Continue&lt;br /&gt;
   2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
   3 - End Loop&lt;br /&gt;
   4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
   5 - Return from subroutine&lt;br /&gt;
   6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
=== Firmware Version (0x0001C) ===&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
=== Serial Flash Control (0x00020) ===&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
=== Serial Number (0x00024) ===&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
=== hardware Type (0x00028) ===&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4076</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4076"/>
		<updated>2010-11-09T06:25:24Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Registers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== VME interface ====&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Test Register (0x00000) ===&lt;br /&gt;
&lt;br /&gt;
Simple Test Register - Value Written is preserved and can be read back.&lt;br /&gt;
&lt;br /&gt;
=== CSR Register (0x00004) ===&lt;br /&gt;
&lt;br /&gt;
The first 5 bits control the ppg, the remaining 26 bits provide read-only status information.&lt;br /&gt;
(writes to the 26 bits of status information are ignored, and overwritten on the next status update)&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit || Name || Access || description&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run || R/W || Run Control/Status&lt;br /&gt;
|-&lt;br /&gt;
|1|| Ext-Clk || R/W || The PPG logic uses the external Clk&lt;br /&gt;
|-&lt;br /&gt;
|2|| Ext-Start|| R/W || &lt;br /&gt;
|-&lt;br /&gt;
|3|| Slow-Clk || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|4|| Test-Mode || R/W || &lt;br /&gt;
|-&lt;br /&gt;
|5-31|| Status || R || Readback of PC,SP,Current Delay Counter&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
RUN bit: Writing 1 here instructs the ppg to begin executing its program, reading this bit returns 1 if the program is still running, or 0 if halted.&lt;br /&gt;
&lt;br /&gt;
Ext_Clk bit: Writing 1 here switches the ppg logic to use the external CLK (Nim_Input[0]) (The VME interface always uses the internal clock)&lt;br /&gt;
&lt;br /&gt;
Ext_Start bit: Writing 1 here disables the CSR-Run-bit-start (Reading this bit still returns the correct status), and switches control to the External Start input (NIM_INPUT[1])&lt;br /&gt;
&lt;br /&gt;
Slow-Clk bit: Writing 1 here Switches the ppg clock to a much slower one (2kHz) for low speed/long delay operation.&lt;br /&gt;
NOTE - this is currently ignored.&lt;br /&gt;
&lt;br /&gt;
Test-mode bit: Writing 1 here Changes the outputs (LED/NIM) to simple follow the state of the Address register.&lt;br /&gt;
&lt;br /&gt;
=== Address Register (0x00008) ===&lt;br /&gt;
&lt;br /&gt;
Sets PPG Program Memory Address - next instruction will be written to this location.  Also when program is started, execution begins from this address&lt;br /&gt;
&lt;br /&gt;
=== Instruction Registers (0x0000C - 0x00018) ===&lt;br /&gt;
&lt;br /&gt;
Registers to hold the 128bit Program Instructions.  Writing the Upper register triggers the storing of the entire 128bit instruction to the address currently in the address register.&lt;br /&gt;
&lt;br /&gt;
The instructions format is as follows ...&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Instruction Format&lt;br /&gt;
|-&lt;br /&gt;
!Bits 0-31 || Bits 32-63 || Bits 64-95 || Bits 96-115 || Bits 116-117 || Bits 118-127&lt;br /&gt;
|-&lt;br /&gt;
| 32 Output Set Bits || 32 Output Clear Bits || 32bit Delay Count || 20bit Data || 4bit instruction type || Ignored&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The 32bit delay count at 100Mhz gives maximum delay of 10 seconds per instruction.&lt;br /&gt;
&lt;br /&gt;
The instruction types are ...&lt;br /&gt;
0 - Halt&lt;br /&gt;
1 - Continue&lt;br /&gt;
2 - new Loop        ( 20 bit data used for count - i.e. maximum 1 million )&lt;br /&gt;
3 - End Loop&lt;br /&gt;
4 - Call Subroutine ( 20 bit data used for address )&lt;br /&gt;
5 - Return from subroutine&lt;br /&gt;
6 - Branch          ( 20 bit data used for address )&lt;br /&gt;
&lt;br /&gt;
=== Firmware Version (0x0001C) ===&lt;br /&gt;
Returns the 32bit unix timestamp corresponding to the date this firmware was compiled.&lt;br /&gt;
&lt;br /&gt;
=== Serial Flash Control (0x00020) ===&lt;br /&gt;
Used for reading/Writing to the Configuration Flash device (Reading/Updating firmware)&lt;br /&gt;
&lt;br /&gt;
=== Serial Number (0x00024) ===&lt;br /&gt;
Returns the module serial number, and Board revision (if set) or -1&lt;br /&gt;
&lt;br /&gt;
=== hardware Type (0x00028) ===&lt;br /&gt;
Returns a 32 bit description of this hardware - which should confirm the identity of this module as a vme-ppg32&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4075</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4075"/>
		<updated>2010-11-09T05:49:43Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* VME-PPG32 - pulse pattern generator VME FPGA board */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== VME interface ====&lt;br /&gt;
&lt;br /&gt;
VME A32/D32 access only. Rotary switches SW1, SW2 and SW3 set the upper 12 bits of the address.&lt;br /&gt;
VME registers are listed in the table below.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Address || Name || Access || Description&lt;br /&gt;
|-&lt;br /&gt;
|  0 || 0x00000 || Test || RW || Test Register&lt;br /&gt;
|-&lt;br /&gt;
|  1 || 0x00004 || CSR || RW || Control/Status Register&lt;br /&gt;
|-&lt;br /&gt;
|  2 || 0x00008 || Addr || RW || Program Address Register&lt;br /&gt;
|-&lt;br /&gt;
|  3 || 0x0000C || Inst_Lo || RW || Instruction Register Part 1/4&lt;br /&gt;
|-&lt;br /&gt;
|  4 || 0x00010 || Inst_Med || RW || Instruction Register Part 2/4&lt;br /&gt;
|-&lt;br /&gt;
|  5 || 0x00014 || Inst_Hi || RW || Instruction Register Part 3/4&lt;br /&gt;
|-&lt;br /&gt;
|  6 || 0x00018 || Inst_Top || RW || Instruction Register Part 4/4&lt;br /&gt;
|-&lt;br /&gt;
|  7 || 0x0001C || Version || R || Firmware Version Register&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 0x00020 || Flash || RW || Serial Flash Control Register&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 0x00024 || Serial || R || Serial Number Register&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 0x00028 || Hardware || R || hardware Identification Register&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4074</id>
		<title>VME-PPG32</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VME-PPG32&amp;diff=4074"/>
		<updated>2010-11-09T05:35:16Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== VME-PPG32 - pulse pattern generator VME FPGA board ==&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
* [http://edev.triumf.ca/projects/edevel00022] VME-PPG32 (REA 198) project page on edev.triumf.ca&lt;br /&gt;
* [http://edev.triumf.ca/documents/27] Rev0 board schematics&lt;br /&gt;
* [http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32] Svn repository for initial test firmware&lt;br /&gt;
* [http://daq-plone.triumf.ca/HR/VME/ppg32] Current PPG firmware Source/binary&lt;br /&gt;
&lt;br /&gt;
=== General characteristics ===&lt;br /&gt;
&lt;br /&gt;
==== Available hardware ====&lt;br /&gt;
&lt;br /&gt;
* Altera cyclone 3 FPGA: EP3C40Q240C8&lt;br /&gt;
* Serial flash for FPGA configuration: Altera EPCS16&lt;br /&gt;
* VME interface: VME-D[31..0] bidirectional, VME-A[23..0] input only, DTACK output, no BERR, no RETRY/RESP. VME-A[31..20] input only connected only to address decoder FPGA (Altera MAX-something CPLD). This permits all single-word transfer modes, 32-bit DMA (BLT32) and 2eVME DMA (only drives D-lines, but still faster than BLT32). 64-bit DMA (MBLT64) and 2eSST are impossible.&lt;br /&gt;
* 32 NIM outputs&lt;br /&gt;
* 4 NIM inputs&lt;br /&gt;
* 32 &amp;quot;NIM output&amp;quot; LEDs&lt;br /&gt;
* 4 &amp;quot;NIM input&amp;quot; LEDs&lt;br /&gt;
* 1 &amp;quot;VME access&amp;quot; LED&lt;br /&gt;
* 2 output serial DAC: AD5439YRUZ&lt;br /&gt;
&lt;br /&gt;
==== Firmware functions ====&lt;br /&gt;
&lt;br /&gt;
TBW&lt;br /&gt;
&lt;br /&gt;
=== Firmware revisions ===&lt;br /&gt;
&lt;br /&gt;
To find out the current firmware revision, read VME register 0, i.e. run &amp;quot;test_VMENIMIO32_gef.exe --addr 0xN00000 --read 0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To write Cyclone 1 FPGA firmware into the flash memory, use a JTAG programmer or a VME programmer:&lt;br /&gt;
&amp;quot;srunner_vme_gef.exe -program -64 ~/daq/VME-NIMIO32/VME-NIMIO32/VME-NIMIO32/VME-NIMIO32.pof 0xN00020&amp;quot;, where &amp;quot;N&amp;quot; is the A24 VME base address.&lt;br /&gt;
&lt;br /&gt;
To reboot the Cyclone 1 FPGA into the new firmware, run &amp;quot;test_VMENIMIO32_gef.exe --addr 0xN00000 --read 0 --write 1 2 --read 0 --sleep 1 --read 0&amp;quot;, where &amp;quot;N&amp;quot; is the A24 VME base address. This requires firmware 0x01100810 or newer and the &amp;quot;fpga-reset&amp;quot; hardware modification.&lt;br /&gt;
&lt;br /&gt;
Firmware for the main FPGA:&lt;br /&gt;
* firmware sources [[http://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-PPG32]]&lt;br /&gt;
* 0x4bcf5aef - [[http://ladd00.triumf.ca/viewcvs/daqsvn/trunk/VME-PPG32/VME-PPG32.pof?revision=73&amp;amp;view=co]]&lt;br /&gt;
&lt;br /&gt;
Firmware for the VME address decoder (same as VME-NIMIO32):&lt;br /&gt;
* firmware sources [[http://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode]]&lt;br /&gt;
* board Rev0 [[http://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?revision=37&amp;amp;view=co]]&lt;br /&gt;
* board Rev1 [[http://ladd00.triumf.ca/viewvc/daqsvn/trunk/VME-NIMIO32/MAX3000A_Addr_decode/VME_Addr_decode.pof?revision=87&amp;amp;view=co]]&lt;br /&gt;
&lt;br /&gt;
=== Manual ===&lt;br /&gt;
&lt;br /&gt;
==== VME interface ====&lt;br /&gt;
&lt;br /&gt;
Firmware 0x01100810 implements VME A24/D32 access only. A24 addresses 0x00N0xxxx are decoded, where &amp;quot;N&amp;quot; is the A24 base address set by rotary switch SW3 &amp;quot;ADDRESS 20-23&amp;quot;. Rotary switches SW1 and SW2 should be set to &amp;quot;0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
VME accessible registers are listed in the table below. VME address offsets are register numbers multiplied by 4, i.e. CSR register 1 is at address 0x00N00004. Flash programmer register 8 is at 0x00N00020 (use this address with srunner_vme flash programmer).&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Number || Name || Access || FwRev || Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || FwRev || RO || || Firmware revision&lt;br /&gt;
|-&lt;br /&gt;
| 1 || CSR || RW || TBW || TBW&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== SOFTWARE ====&lt;br /&gt;
&lt;br /&gt;
===== test_VMENIMIO32.exe =====&lt;br /&gt;
&lt;br /&gt;
Command line switches:&lt;br /&gt;
&lt;br /&gt;
* --addr 0x00N00000 - module A24 base address, N is the setting of rotary switch SW3 &amp;quot;ADDRESS 20-23&amp;quot;&lt;br /&gt;
* --read MMM - read register MMM, i.e. &amp;quot;--read 0&amp;quot; reads the firmware revision&lt;br /&gt;
* --write MMM VVV - write value VVV into register MMM, i.e. &amp;quot;--write 1 0&amp;quot; writes 0 to the CSR&lt;br /&gt;
* --readscalers - read the 32 input scalers, print scaler value, counting rate using the 20 MHz timestamp clock and counting rate using the computer clock.&lt;br /&gt;
* --pulsenim - pulse all NIM outputs&lt;br /&gt;
* --sleep SSS - sleep SSS seconds, i.e. &amp;quot;--sleep 1&amp;quot; sleeps for 1 second.&lt;br /&gt;
* --readtsc - example reading TSC register&lt;br /&gt;
* --readtsc4 - example reading and decoding the TSC4 data, programming TSC4 routing&lt;br /&gt;
&lt;br /&gt;
=== Board modifications ===&lt;br /&gt;
&lt;br /&gt;
==== Rev0 modifications ====&lt;br /&gt;
&lt;br /&gt;
* multiple mistakes on PCB&lt;br /&gt;
&lt;br /&gt;
K.O.&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4310</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4310"/>
		<updated>2010-10-15T23:20:58Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* VME Mapping */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes. [X=&amp;gt;Any Value, N=&amp;gt;Any non-zero Value]&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x000X||CSR||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x001X||SSCSR ||W||D32&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x002X||TestReg||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x003X||Firmware ID ||R ||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040,1||SoftReset||W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x0044,5||Nframes(Also A0)||R||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x005X||Param DAT ||W ||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x006X||Param ID ||W ||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x007X||Software Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x008X||LVDS Reset||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x009X||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00AX||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00BX||General Reset || W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00CX||Trigger Config A||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x00DX||Trigger Config B||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x00EX||Serial Program||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0xNNXX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
*triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
*triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
*triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
*triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
*triggerconfig[39.. 4] = GroupThresholds     6 multiplicity thresholds, of 6 bits each (0-63)&lt;br /&gt;
*triggerconfig[57..40] = FeGroups            6 Logical-group-id&#039;s of 3 bits each (0-7)&lt;br /&gt;
*triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 logical groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each.  Each frontend sends its trigger multiplicity (0-8) to the collector.  There are 6 possible logical groups to assign each of the frontends to (One simple scheme would be to put all 6 frontends in a single logical group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
The above trigger logic settings are currently assigned using 4 ODB variables described below ...&lt;br /&gt;
&lt;br /&gt;
GroupID - Sets the Logical GroupID for each frontend&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe5&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe4&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe3&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe2&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe1&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti02 - Sets the required multiplicity for logical groups 0 to 2&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup2&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup1&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti35 - Sets the required multiplicity for logical groups 3 to 5&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup5&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup4&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupCoincidence - Sets which logical groups multiplicities are required to be satisfied (All The groups set active here, are required in coincidence in order to get a trigger)&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| ... ||16||15|| || || || || || ||8||7||6||5||4||3||2||1||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;13&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
| GroupID5&lt;br /&gt;
| GroupID4&lt;br /&gt;
| GroupID3&lt;br /&gt;
| GroupID2&lt;br /&gt;
| GroupID1&lt;br /&gt;
| GroupID0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4309</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4309"/>
		<updated>2010-10-15T23:20:58Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* VME Mapping */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes. [X=&amp;gt;Any Value, N=&amp;gt;Any non-zero Value]&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x000X||CSR||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x001X||SSCSR ||W||D32&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x002X||TestReg||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x003X||Firmware ID ||R ||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040,1||SoftReset||W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x0044,5||Nframes(Also A0)||R||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x005X||Param DAT ||W ||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x006X||Param ID ||W ||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x007X||Software Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x008X||LVDS Reset||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x009X||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00AX||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00BX||General Reset || W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00CX||Trigger Config A||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x00DX||Trigger Config B||R/W||D32&lt;br /&gt;
|-&lt;br /&gt;
|0x00EX||Serial Program||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0xNNXX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
*triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
*triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
*triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
*triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
*triggerconfig[39.. 4] = GroupThresholds     6 multiplicity thresholds, of 6 bits each (0-63)&lt;br /&gt;
*triggerconfig[57..40] = FeGroups            6 Logical-group-id&#039;s of 3 bits each (0-7)&lt;br /&gt;
*triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 logical groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each.  Each frontend sends its trigger multiplicity (0-8) to the collector.  There are 6 possible logical groups to assign each of the frontends to (One simple scheme would be to put all 6 frontends in a single logical group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
The above trigger logic settings are currently assigned using 4 ODB variables described below ...&lt;br /&gt;
&lt;br /&gt;
GroupID - Sets the Logical GroupID for each frontend&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe5&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe4&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe3&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe2&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe1&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti02 - Sets the required multiplicity for logical groups 0 to 2&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup2&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup1&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti35 - Sets the required multiplicity for logical groups 3 to 5&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup5&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup4&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupCoincidence - Sets which logical groups multiplicities are required to be satisfied (All The groups set active here, are required in coincidence in order to get a trigger)&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| ... ||16||15|| || || || || || ||8||7||6||5||4||3||2||1||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;13&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
| GroupID5&lt;br /&gt;
| GroupID4&lt;br /&gt;
| GroupID3&lt;br /&gt;
| GroupID2&lt;br /&gt;
| GroupID1&lt;br /&gt;
| GroupID0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4308</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4308"/>
		<updated>2010-09-17T00:05:27Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Aux Output */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes.&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x0000||CSR||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0010|| || ||&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x0020|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0030||Firmware ID ||R || D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0050||Param DAT ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0060||Param ID ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0070||Soft Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0080|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0090||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00A0||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00B0||Global Reset || W ||&lt;br /&gt;
|-&lt;br /&gt;
|0x01XX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
*triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
*triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
*triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
*triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
*triggerconfig[39.. 4] = GroupThresholds     6 multiplicity thresholds, of 6 bits each (0-63)&lt;br /&gt;
*triggerconfig[57..40] = FeGroups            6 Logical-group-id&#039;s of 3 bits each (0-7)&lt;br /&gt;
*triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 logical groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each.  Each frontend sends its trigger multiplicity (0-8) to the collector.  There are 6 possible logical groups to assign each of the frontends to (One simple scheme would be to put all 6 frontends in a single logical group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
The above trigger logic settings are currently assigned using 4 ODB variables described below ...&lt;br /&gt;
&lt;br /&gt;
GroupID - Sets the Logical GroupID for each frontend&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe5&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe4&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe3&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe2&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe1&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti02 - Sets the required multiplicity for logical groups 0 to 2&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup2&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup1&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti35 - Sets the required multiplicity for logical groups 3 to 5&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup5&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup4&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupCoincidence - Sets which logical groups multiplicities are required to be satisfied (All The groups set active here, are required in coincidence in order to get a trigger)&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| ... ||16||15|| || || || || || ||8||7||6||5||4||3||2||1||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;13&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
| GroupID5&lt;br /&gt;
| GroupID4&lt;br /&gt;
| GroupID3&lt;br /&gt;
| GroupID2&lt;br /&gt;
| GroupID1&lt;br /&gt;
| GroupID0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4307</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4307"/>
		<updated>2010-09-17T00:05:27Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Aux Output */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes.&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x0000||CSR||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0010|| || ||&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x0020|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0030||Firmware ID ||R || D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0050||Param DAT ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0060||Param ID ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0070||Soft Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0080|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0090||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00A0||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00B0||Global Reset || W ||&lt;br /&gt;
|-&lt;br /&gt;
|0x01XX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
*triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
*triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
*triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
*triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
*triggerconfig[39.. 4] = GroupThresholds     6 multiplicity thresholds, of 6 bits each (0-63)&lt;br /&gt;
*triggerconfig[57..40] = FeGroups            6 Logical-group-id&#039;s of 3 bits each (0-7)&lt;br /&gt;
*triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 logical groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each.  Each frontend sends its trigger multiplicity (0-8) to the collector.  There are 6 possible logical groups to assign each of the frontends to (One simple scheme would be to put all 6 frontends in a single logical group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
The above trigger logic settings are currently assigned using 4 ODB variables described below ...&lt;br /&gt;
&lt;br /&gt;
GroupID - Sets the Logical GroupID for each frontend&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe5&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe4&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe3&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe2&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe1&lt;br /&gt;
|  colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|GroupIDFe0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti02 - Sets the required multiplicity for logical groups 0 to 2&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup2&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup1&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupMulti35 - Sets the required multiplicity for logical groups 3 to 5&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || ||24||23|| || || || || || |16||15|| || || || || || ||8||7|| || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;14&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup5&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup4&lt;br /&gt;
|  colspan=&amp;quot;6&amp;quot; align=&amp;quot;center&amp;quot;|MultiplicityGroup3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
GroupCoincidence - Sets which logical groups multiplicities are required to be satisfied (All The groups set active here, are required in coincidence in order to get a trigger)&lt;br /&gt;
{| style=&amp;quot;color:black; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| ... ||16||15|| || || || || || ||8||7||6||5||4||3||2||1||0 &lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;13&amp;quot; align=&amp;quot;center&amp;quot;|Unused&lt;br /&gt;
| GroupID5&lt;br /&gt;
| GroupID4&lt;br /&gt;
| GroupID3&lt;br /&gt;
| GroupID2&lt;br /&gt;
| GroupID1&lt;br /&gt;
| GroupID0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4306</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4306"/>
		<updated>2010-09-16T21:23:42Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Aux Output */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes.&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x0000||CSR||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0010|| || ||&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x0020|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0030||Firmware ID ||R || D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0050||Param DAT ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0060||Param ID ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0070||Soft Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0080|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0090||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00A0||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00B0||Global Reset || W ||&lt;br /&gt;
|-&lt;br /&gt;
|0x01XX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
*triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
*triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
*triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
*triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
*triggerconfig[39.. 4] = GroupThresholds     6 thresholds of 6 bits each (0-63)&lt;br /&gt;
*triggerconfig[57..40] = FeGroups            6 groupid&#039;s of 3 bits each (0-7)&lt;br /&gt;
*triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each, each sends its trigger multiplicity (0-8) to the collector.  There are 6 possible groups to assign the frontends to (One simple scheme would be to put  all 6 in a single group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4305</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4305"/>
		<updated>2010-09-16T21:23:42Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Aux Output */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes.&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x0000||CSR||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0010|| || ||&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x0020|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0030||Firmware ID ||R || D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0050||Param DAT ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0060||Param ID ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0070||Soft Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0080|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0090||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00A0||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00B0||Global Reset || W ||&lt;br /&gt;
|-&lt;br /&gt;
|0x01XX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
*triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
*triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
*triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
*triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
*triggerconfig[39.. 4] = GroupThresholds     6 thresholds of 6 bits each (0-63)&lt;br /&gt;
*triggerconfig[57..40] = FeGroups            6 groupid&#039;s of 3 bits each (0-7)&lt;br /&gt;
*triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each, each sends its trigger multiplicity (0-8) to the collector.  There are 6 possible groups to assign the frontends to (One simple scheme would be to put  all 6 in a single group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4304</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4304"/>
		<updated>2010-09-16T21:21:34Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Triggers &amp;amp; Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes.&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x0000||CSR||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0010|| || ||&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x0020|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0030||Firmware ID ||R || D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0050||Param DAT ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0060||Param ID ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0070||Soft Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0080|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0090||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00A0||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00B0||Global Reset || W ||&lt;br /&gt;
|-&lt;br /&gt;
|0x01XX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
triggerconfig[39.. 4] = GroupThresholds     6 thresholds of 6 bits each (0-63)&lt;br /&gt;
triggerconfig[57..40] = FeGroups            6 groupid&#039;s of 3 bits each (0-7)&lt;br /&gt;
triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each, each sends its trigger multiplicity (0-8) to the collector.  There are 6 possible groups to assign the frontends to (One simple scheme would be to put  all 6 in a single group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4303</id>
		<title>VF48</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/DaqWiki/index.php?title=VF48&amp;diff=4303"/>
		<updated>2010-09-16T21:21:34Z</updated>

		<summary type="html">&lt;p&gt;Cpearson: /* Triggers &amp;amp; Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= VF48 - 48 channels@60Msps, 10bits =&lt;br /&gt;
&lt;br /&gt;
== General characteristics ==&lt;br /&gt;
The VF48 is a one-unit wide VME 6U housing 48 channels digitized by six fast 10-bit ADCs. For each channel, the input signal (50 Ω impedance) is amplified by a high speed differential amplifier (AD8132) and them converted by the ADCs at a maximum rate of 60 Msps. &lt;br /&gt;
&lt;br /&gt;
The digitized signal goes to a FPGA (Cyclone EPC12) which will calculate the charge of the signal, evaluate the exact trigger time, build an event which will contain all this information and send the event constructed to a local collector. Each FPGA manages eight channels. There are six FPGA connected to the ADCs and one FPGA which collects the data.&lt;br /&gt;
&lt;br /&gt;
The board can be accessed in A24/A32/A40 addressing mode, D16, D32 and MBLT64 data transfer mode. &lt;br /&gt;
&lt;br /&gt;
It has also a board available to access the VF48 throw a LVDS link. This link can transfer the data at a speed up to 100 Mbits/s. This link can afford all the control necessary to run the VF48. It can accept a clock which permits the synchronization of many VF48 units. &lt;br /&gt;
&lt;br /&gt;
The board contains a trigger structure which permits to trigger the data in three different manners. The trigger can come from an external NIM signal, from a software command or from an internal mechanism. The internal mechanism manages multiple channels hit, deadtime, threshold and multiplicity and is totally programmable by the user.&lt;br /&gt;
&lt;br /&gt;
[[Image:blockdigvf48.jpg|Block Diagram of the VF48]]&lt;br /&gt;
&lt;br /&gt;
= VME interface =&lt;br /&gt;
The VF48 board can access the VME bus in VME A24. See Table 2.1.1 to have more information about the Address Modifier accepted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Summarizes all the supported address Modifer&lt;br /&gt;
|-&lt;br /&gt;
!AM||Description&lt;br /&gt;
|-&lt;br /&gt;
|3F&lt;br /&gt;
|A24 supervisory block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|3D&lt;br /&gt;
|A24 supervisory data access&lt;br /&gt;
|-&lt;br /&gt;
|3C&lt;br /&gt;
|A24 supervisory 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|3B&lt;br /&gt;
|A24 non privileged block transfer (BLT)&lt;br /&gt;
|-&lt;br /&gt;
|39&lt;br /&gt;
|A24 non privileged data access&lt;br /&gt;
|-&lt;br /&gt;
|38&lt;br /&gt;
|A24 non privileged 64-bit block transfer (MBLT)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Base Address ===&lt;br /&gt;
&lt;br /&gt;
The base address of the board is 0xA00000 + n • 0x10000. The number n is defined by the alignment of the switch on the board. For example, if the alignment on the switch is : ID[3..0] = 1011, then the base address will be 0xAB0000. &lt;br /&gt;
&lt;br /&gt;
Every board will manage a window going until 0x00FFFF above the base address. In the previous example, the VME window was from 0xAB0000 to 0xABFFFF.&lt;br /&gt;
&lt;br /&gt;
=== Data Transfer Capabilities ===&lt;br /&gt;
The board can access the VME BUS in VME_D16, VME_D32, VME 32-bit and 64-bit block transfers (BLT32 and MBLT64). The VME_D8 is not compatible. D32 is recommended for accessing collector registers and 64-bit block transfer (MBLT64) is recommended for reading data from the VME data FIFO. See VME Mapping to have more details on this.&lt;br /&gt;
&lt;br /&gt;
==VME Mapping==&lt;br /&gt;
&lt;br /&gt;
The Table 2.2.1 describes the VME Mapping of the VF48 collector registers. In the Table 2.2.1, the W column indicates if the register is available for a Write. The R column indicates if the register is available for a Read. The last three columns indicate permitted access modes.&lt;br /&gt;
&lt;br /&gt;
– VME Mapping&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-!Offset ||VME Mapping ||Access ||Mode&lt;br /&gt;
|-&lt;br /&gt;
|0x0000||CSR||R/W||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0010|| || ||&lt;br /&gt;
|-	 	 	 	 &lt;br /&gt;
|0x0020|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0030||Firmware ID ||R || D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0040|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0050||Param DAT ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0060||Param ID ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0070||Soft Trigger ||W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x0080|| || ||&lt;br /&gt;
|-&lt;br /&gt;
|0x0090||Group Enable ||R/W ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00A0||NbrFrames  ||R ||D16/32&lt;br /&gt;
|-&lt;br /&gt;
|0x00B0||Global Reset || W ||&lt;br /&gt;
|-&lt;br /&gt;
|0x01XX||Event Data ||R ||D32/BLT32/MBLT64&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
===CSR Description ===&lt;br /&gt;
Only six bits of the CSR (Control &amp;amp; Status Registry) are used. They are indicated in the Table 2.2.2.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:green; background-color:#ffffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+CSR Description&lt;br /&gt;
|-&lt;br /&gt;
!Bit ||CSR Description ||Access&lt;br /&gt;
|-&lt;br /&gt;
|0|| Run ||R/W&lt;br /&gt;
|-&lt;br /&gt;
|1|| Parameter ID Ready|| R&lt;br /&gt;
|-&lt;br /&gt;
|2|| Parameter DATA Ready||R&lt;br /&gt;
|-&lt;br /&gt;
|3|| Event Fifo Empty||R&lt;br /&gt;
|-&lt;br /&gt;
|4|| || &lt;br /&gt;
|-&lt;br /&gt;
|5||CRC Error detected || R&lt;br /&gt;
|-&lt;br /&gt;
|6|| || &lt;br /&gt;
|-&lt;br /&gt;
|7||External Trigger || R/W&lt;br /&gt;
|-&lt;br /&gt;
|} 	 	 	 &lt;br /&gt;
&lt;br /&gt;
The RUN bit allows the system to accept triggers and start the acquisition. &lt;br /&gt;
&lt;br /&gt;
The Parameter ID Ready bit and Parameter DAT Ready bit indicate if parameter is ready to be read. The parameter section will describe more precisely how these bits work.&lt;br /&gt;
&lt;br /&gt;
The Event Fifo Empty bit indicates if the event fifo is empty. When this signal is low, there’s data ready to be read.  &lt;br /&gt;
&lt;br /&gt;
The CRC Error Detected bit indicates if a CRC Error has been detected in the serial communication on the board. This bit should never go on.&lt;br /&gt;
&lt;br /&gt;
The External trigger bit selects the external trigger. If this bit is set to 1, the trigger that will start the acquisition must come from the connector on the front panel. If this bit is zero, then a real signal must be detected on one of the 48 channels if you want to have event built.&lt;br /&gt;
&lt;br /&gt;
=== Firmware ID (0x000030) ===&lt;br /&gt;
It returns the firmware ID&lt;br /&gt;
&lt;br /&gt;
===Parameter DAT (0x000050)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===	Parameter ID (0x000060)===&lt;br /&gt;
Register used to write the parameter. See the section Writing/Reading Parameter for more details.&lt;br /&gt;
&lt;br /&gt;
===Soft Trigger (0x000070)===&lt;br /&gt;
It generates a trigger on the front end to force the system to acquire data.&lt;br /&gt;
&lt;br /&gt;
===Group Enable (0x000090)===&lt;br /&gt;
It allows enabling a group of channels. Bit 0 enables channel 1 to 8, bit 1 enables channel 9 to 16 until bit 5 which enable channels 41 to 48. By default, they are all enabled.&lt;br /&gt;
2.2.7.	Nbr Frames (0x0000A0)&lt;br /&gt;
It gives the number of data present in the event fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
===Global Reset (0x0000B0)===&lt;br /&gt;
It resets all the system.&lt;br /&gt;
&lt;br /&gt;
===Event Data (0x000100-0x00FFFF)===&lt;br /&gt;
It reads all the data in the fifo. See section 4. Triggers &amp;amp; Events for more details.&lt;br /&gt;
&lt;br /&gt;
= Writing/Reading Parameter =&lt;br /&gt;
To write a parameter, you must write the parameter ID (See Table 3.1.1) followed by the parameter Data. You write the parameter ID by doing a VME Write at the address Param ID and you write the parameter Data by doing a VME Write at the address Param DAT.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it. So, the procedure to read a parameter is this. First, you send the request by writing the parameter ID (VME Write at the address ParamID) with bit 7 set to 1. You must also send a fake data, because if you don’t send a fake data, the request will never be sent. After, you read bit 2 of the CSR until it has been set. When the bit is set, you do a VME Read at the address ParamDAT .&lt;br /&gt;
&lt;br /&gt;
===Parameter Frame Header===&lt;br /&gt;
The first 16 bits of a frame contain information describing the contents of the parameter.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter Frame Header&lt;br /&gt;
|-&lt;br /&gt;
!15|| || || ||11|| || || ||7||6|| || || || || || 0&lt;br /&gt;
|-&lt;br /&gt;
|C ||C||C||C|| D||D||D||D||R||V||P||P||P||P||P||P&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* C : Destination Card or Port or Cyclone&lt;br /&gt;
* D : Destination Channel (0-5) &lt;br /&gt;
* R : ReadBit &lt;br /&gt;
* V : Version (0- No extension; 1- Param ID 32 bit)&lt;br /&gt;
* P : Parameter ID&lt;br /&gt;
&lt;br /&gt;
Description of the fields Parameter Frame Header: &lt;br /&gt;
Destination Card&lt;br /&gt;
Bits 11 - 8 contain the number of the card where parameter must be sent. The following table describes the direction which has to take parameter according to the number of destination of card, the number of port or the number of cyclone on the board.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Destination Cyclone&lt;br /&gt;
|-&lt;br /&gt;
!11	||10||	9||	8||	Destination Cyclone	||Port&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	0||	Channel 1 to 8	||0&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	0||	1||	Channel 9 to 16	||1&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	0||	Channel 17 to 24||	2&lt;br /&gt;
|-&lt;br /&gt;
|0	||0||	1||	1||	Channel 25 to 32||	3&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	0||	Channel 33 to 40||	4&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	0||	1||	Channel 41 to 48||	5&lt;br /&gt;
|-&lt;br /&gt;
|0	||1||	1||	0||	Not used	||Not used&lt;br /&gt;
|-&lt;br /&gt;
|1	||1||	1||	1||	Not used	||Not used&lt;br /&gt;
|}&lt;br /&gt;
* Destination Channel&lt;br /&gt;
This field is not used for the current version. We don’t care of these bits.&lt;br /&gt;
&lt;br /&gt;
* ReadBit&lt;br /&gt;
Bit 7 indicates if command is a demand of writing or reading of the parameter. If ReadBit is HIGH, then it is a read and parameter should be sent back to the collector. If ReadBit is LOW, then it is a write and parameter should be recorded.&lt;br /&gt;
&lt;br /&gt;
During a parameter read, it is necessary to be aware that parameter is not immediately in the register ParamDAT. The bit 2 of the CSR rises up when the parameter is ready and falls down when you read it.&lt;br /&gt;
Version Bit&lt;br /&gt;
&lt;br /&gt;
This bit must be zero in this version&lt;br /&gt;
Parameter ID&lt;br /&gt;
The last six bits contains the parameter ID. Each parameter available is displayed in the Table 3.1.3&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Parameter List&lt;br /&gt;
|-&lt;br /&gt;
!ID#	||Parameter List||	Default Value||	Access&lt;br /&gt;
|-&lt;br /&gt;
|0  ||	|| ||	 	 	 &lt;br /&gt;
|-&lt;br /&gt;
|1||	PED	||0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|2||	Hit Det Threshold||	0x000A	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|3||	Clip Delay	||0x0028	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|4||	PreTrigger	||0x0020	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|5||	Segment Size	||0x0100	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|6||	K	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|7||	L	||0x0200	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|8||	M	||0x1000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|9||	Channel Enable	||0x00FF	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|10||	Mbits 1 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|11||	Mbits 2 - Feature Enable||	0x0000	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|12||	Latency	||0x0005	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|13||	Firmware ID	||0x0207	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|14||	Attenuator	||0x0190	||R/W&lt;br /&gt;
|-&lt;br /&gt;
|15||	Trigger Threshold||	0x000A	||R/W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===	Parameter Description ===&lt;br /&gt;
This section is there to describe each parameter.&lt;br /&gt;
1 - PED&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
2 – Hit Detection Threshold&lt;br /&gt;
This parameter defines the threshold to detect a hit. If the signal given by the ADC is above this threshold value, the system will start to calculate the charge, but if the signal doesn’t reach the trigger threshold, the charge won’t be used.&lt;br /&gt;
3 – Clip Delay&lt;br /&gt;
This parameter is not used yet.&lt;br /&gt;
4 – Pre-Trigger&lt;br /&gt;
This parameter defines the number of clock where the data must be recorded before the trigger. &lt;br /&gt;
5 – Segment Size&lt;br /&gt;
This parameter defines the number of raw data that must be recorded. &lt;br /&gt;
6 - K&lt;br /&gt;
This parameter defines the peaking time. See the signal processing section for more details. &lt;br /&gt;
7 - L&lt;br /&gt;
This parameter represents the duration of the peaking time and the flat top together. See the signal processing section for more details.&lt;br /&gt;
8 - M&lt;br /&gt;
This parameter defines a multiplication factor of the convoluted signal. See the signal processing section for more details.&lt;br /&gt;
9 – Channel Enable&lt;br /&gt;
This parameter indicates the channels that must be included in the event. Bit 0 enables channel 0, bit 1 enables channel 1, so in succession until channel 7. By default, all channels are enabled.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
10 – M_Bits&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.1 gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||    Data Simulation||	Data Simulation&lt;br /&gt;
|-&lt;br /&gt;
|1||	Suppress Raw Data||	Supress Raw Data&lt;br /&gt;
|-&lt;br /&gt;
|2||	Select Corrected Data||	Select Corrected Data&lt;br /&gt;
|-&lt;br /&gt;
|3||	PolPlus||	PolPlus&lt;br /&gt;
|-&lt;br /&gt;
|4||	BLR Speed (bit 0)||	Disable ADC&lt;br /&gt;
|-&lt;br /&gt;
|5||	BLR Speed (bit 1)||	Fake One Data&lt;br /&gt;
|-&lt;br /&gt;
|6||	Hold BLR	||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 -	||-&lt;br /&gt;
|-&lt;br /&gt;
|8||	Disable ADC	||-&lt;br /&gt;
|-&lt;br /&gt;
|9||	Offset 1	||-&lt;br /&gt;
|-&lt;br /&gt;
|10||	Offset 2	||-&lt;br /&gt;
|-&lt;br /&gt;
|11||	Low Gain Selection	||-&lt;br /&gt;
|-&lt;br /&gt;
|12||	Card Revision Number (bit 0)	||-&lt;br /&gt;
|-&lt;br /&gt;
|13||	Card Revision Number (bit 1)	||-&lt;br /&gt;
|-&lt;br /&gt;
|14||	Card Revision Number (bit 2)	||-&lt;br /&gt;
|-&lt;br /&gt;
|15||	Card Revision Number (bit 3)	||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The bit 0, Data Simulation, enables the simulator. If this bit is set, the simulated data will be continually sent.&lt;br /&gt;
&lt;br /&gt;
The bit 1, Suppress Raw Data, suppresses the raw data independently of the segment size parameter. &lt;br /&gt;
&lt;br /&gt;
The bit 2, Select Corrected Data, is not used in the current version.  &lt;br /&gt;
&lt;br /&gt;
The bit 3, PolPlus, is used to invert numerically the input. If the input is 0b0100010001, and the bit PolPlus set then the input will be 0b1011101110.&lt;br /&gt;
&lt;br /&gt;
The bit 8, Disable ADC, disable the ADC. &lt;br /&gt;
&lt;br /&gt;
The bit 5, Fake One Data, has the same use as the bit 0, Data Simulation, but it will be activated for only one valid signal. &lt;br /&gt;
&lt;br /&gt;
All the other bits are reserved for future use. The names indicated represent the function that is reserved for the bit to be compatible with other project.&lt;br /&gt;
11 – M_Bits 2&lt;br /&gt;
This parameter is a parameter where each bit has a different purpose. The Table 3.2.2   gives information about these bits. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Description  of the MBits 2 parameter&lt;br /&gt;
|-&lt;br /&gt;
!Bit||	Version 2.0 and more||	Version before 2.0&lt;br /&gt;
|-&lt;br /&gt;
|0||	Enable Channel Suppression	||-&lt;br /&gt;
|-&lt;br /&gt;
|1||	Doesn&#039;t send time evaluation	||-&lt;br /&gt;
|-&lt;br /&gt;
|2||	Doesn&#039;t send charge calculated	||-&lt;br /&gt;
|-&lt;br /&gt;
|3||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|4||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|5||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|6||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|7||	 	-||-&lt;br /&gt;
|-&lt;br /&gt;
|15..8||Sampling Rate Divider||-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* bit 0, Enable Channel Suppression, disable an entire channel within a group if none of the sample values of that channel is above the hit threshold.&lt;br /&gt;
&lt;br /&gt;
* bit 1, Doesn’t send charge calculated, disables the calculation of the charge. If this bit is set, the charge won’t be calculated.&lt;br /&gt;
&lt;br /&gt;
* bit 2, Doesn’t send time evaluation, disables the evaluation of the time when the signals passes above the threshold. If this bis set, the time won’t be evaluated.&lt;br /&gt;
&lt;br /&gt;
Note: In version previous to version 2.0.7, the parameter 11 was FeatureDelay_B. This parameter doesn’t exist anymore.&lt;br /&gt;
12 – Latency&lt;br /&gt;
This parameter defines the number of clock to be added to the pre-trigger. This parameter should represent the time between the hit detection and the trigger accepted received by the front end. &lt;br /&gt;
13 – Firmware ID&lt;br /&gt;
This parameter is firmware ID. For example, if the version is 1.0.0, it will return 0x0100. If the version is 11.12.13, it will return 0x0BCD.&lt;br /&gt;
14 – Attenuator&lt;br /&gt;
This parameter defines the attenuation of the integration. See the signal processing section for more details.&lt;br /&gt;
15 – Trigger Threshold&lt;br /&gt;
This parameter defines the threshold to accept a trigger. If the signal given by the ADC is above the threshold value, a trigger request will be sent to the collector.&lt;br /&gt;
 &lt;br /&gt;
=	Triggers &amp;amp; Events=&lt;br /&gt;
&lt;br /&gt;
When a trigger is accepted, the front end starts to build an event which will be transferred to the collector. Each event has the same format. This section defines this format, but before, let us defines some terms usually used in this section.&lt;br /&gt;
&lt;br /&gt;
A Packet is a word of 32 bits which contains information related with an event.&lt;br /&gt;
&lt;br /&gt;
An Event is a series of packet beginning with a header and ending by a trailer.&lt;br /&gt;
&lt;br /&gt;
==	Trigger Detection==&lt;br /&gt;
Each channel goes through a comparator in order to trigger the feature evaluation. The hit threshold is a positive difference of 2 ADC values separated by 2 samples (ex: 2,3,4,5,6,7  hit Thr= 6-3).&lt;br /&gt;
In the case the input signal has the opposite polarity, you can either reverse the input signal (the VF48 input is bipolar) or reverse the polarity by software. The polarity switch is applied to the digitized ADC values. Currrently no dedicated reverse polarity function is available. Use the example found under midas/examples/Triumf/c/fevmemodules.c/BOR function.&lt;br /&gt;
The acceptance of the next trigger is garanteed when there is space for one event or more. A corresponding deadtime is generated for the duration of the capture of the raw data in the frontend buffer. The buffer size is fixed at 1000 samples. Therefore the pipeline advantage starts when the event size is less than 500 samples (this limits is set by the hardware type used on the board). &lt;br /&gt;
There is an output signal (busy out signal) available reflecting the non acceptance of trigger by the VF48. This correspond to the &amp;quot;deadtime&amp;quot; from the raw data capture ored with the condition of the frontend buffer having no more room for a complete event.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Description==&lt;br /&gt;
An event is broken in many packets which follow a precise order. It always has to begin with a header and end with a trailer. The header and the trailer contain the trigger number and they must be identical. The header is always followed by a timestamp. Then, for each channel enabled, it could contain the raw data, the CFD time evaluated and the charge calculated. The Table 4.2.1 shows the content of an event.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event’s content&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Event Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|…	 ||&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data (of current channel)	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time (of current channel)	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge (of current channel)	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Event Trailer	||0xE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The number of raw data is configurable by the parameter Segment Size (Chan Param ID:5). The next section will describe more in detail each of these packets.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==	Event Packet Format==&lt;br /&gt;
This section describes in detail the contents of each of the packets. Firstly, inside a packet, the 4 MSB indicates the type of packet. The next table makes the association between the MSB and the packets.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+Event  Packet MSB Association&lt;br /&gt;
|-&lt;br /&gt;
!Packet&#039;s Type	||MSB&lt;br /&gt;
|-&lt;br /&gt;
|Header	||0x8&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 1	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Time Stamp 2	||0xA&lt;br /&gt;
|-&lt;br /&gt;
|Channel ID	||0xC&lt;br /&gt;
|-&lt;br /&gt;
|Raw Data	||0x0&lt;br /&gt;
|-&lt;br /&gt;
|CFD Time	||0x4&lt;br /&gt;
|-&lt;br /&gt;
|Charge	||0x5&lt;br /&gt;
|-&lt;br /&gt;
|Trailer	||0xE&lt;br /&gt;
|-&lt;br /&gt;
|Header Error	||0x9&lt;br /&gt;
|-&lt;br /&gt;
|Error	||0xF&lt;br /&gt;
|-&lt;br /&gt;
|Header  ||0x8xxxxxxx&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The packet Header is always the first packet of an event. It contains the trigger number in the bits 23 to 0. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.2 – Header 0x8xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot; &lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T||T&lt;br /&gt;
|}&lt;br /&gt;
				Trigger Number												&lt;br /&gt;
&lt;br /&gt;
Header Error - 0x9xxxxxxx&lt;br /&gt;
The Header Error packet occurs when the first packet of a group was not a Header packet. This could be caused by an internal error. If this packet is detected, the current event must be rejected. However, this packet must not happen and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.3 – Header Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time Stamp - 0xAxxxxxxx&lt;br /&gt;
The Time Stamp packet is the second packet and the third packet of en event. It contains a 48 bits time stamps. The time between two steps is of 25 ns . Then, with a 48 bits timestamp, the maximum time measured is 7 036 874,418 seconds. Then, system can count time without completing a buckle during more than 81 days.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.4 – Time Stamp – 0xAxxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||0||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Time Stamp&lt;br /&gt;
|}&lt;br /&gt;
				 												&lt;br /&gt;
The first time stamp packet contains bit 47 to 24 and the second time stamp packet contains bits 23 to 0. &lt;br /&gt;
Channel ID - 0xCxxxxxxx&lt;br /&gt;
The channel ID packet is the first packet of a sub-event. It contains all the information to be able to identify the channel. Bit 3 to 0 indicates the channel number. This number can go from 0 to 7. It corresponds to the channel of a particular group. Then, bits 6 to 3 identify the group. They can so take a value going from 0 to 5. Bit 7 is not used in this version.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.5 – Channel ID – 0xC0xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || ||11|| || ||8||7||6|| || ||3|| || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||0||0||0||0||0||0||0||0||0||0||0||0|| 0||0||0||0||0|| colspan=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot;|Group||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|Channel&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Data - 0x0xxxxxxx&lt;br /&gt;
The Data packet comes after the channel ID packet. It simply contains two data of 10 bits each. The number of data packet within an event is related to the segment size parameter (Chan Param ID: 5). It could arise problems to have a null value or an odd value of the segment size.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.6 – Data – 0x0xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || ||13|| || || ||9|| || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||0||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sampe n+1|| 0||0||0||0|| colspan=&amp;quot;10&amp;quot; align=&amp;quot;center&amp;quot;|Sample n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Be careful about the position of the second data. It doesn’t start exactly to bit 16. It starts to bit 14. This is done to keep the compatibility with an ADC that would a 14 bits data. &lt;br /&gt;
CFD Time - 0x4xxxxxxx&lt;br /&gt;
The CFD Time packet is the second packet before the last packet. It contains the CFD Time.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.7 – CFD Time – 0x40xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0|| colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| CFD Time&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Time algorithm: CDF Equivalent. The input is first clipped with a delay of 3 clocks. If the clipped signal is above the hit threshold then the maximum value of the clipped waveform is evaluated. The CFD time is then evaluated by interpolating the time at 50% charge using the two samples on either side of the 50% fraction.  &lt;br /&gt;
&lt;br /&gt;
Charge - 0x5xxxxxxx&lt;br /&gt;
The Charge Packet is the first packet before the trailer packet. It contains the charge internally calculated. &lt;br /&gt;
&lt;br /&gt;
Table 4.3.8 – Charge – 0x50xxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 0||1||0||1||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;|Charge&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Trailer - 0xExxxxxxx&lt;br /&gt;
The trailer is always the last packet of an event. It contains the trigger number in the bits 23 to 0. The bit 28 indicates an out of sequence flag, then, if this bit is 1, that means that an internal error took place and the packet should be rejected. In theory, system is stable and this type of error should not occur.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.9 – Trailer – 0xExxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||0||colspan=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;|0||  colspan=&amp;quot;24&amp;quot; align=&amp;quot;center&amp;quot;| Trigger Number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Error - 0xFxxxxxxx&lt;br /&gt;
The Error packet occurs when a particular packet is not at his right position. This could occur if a timestamp is missing or if a timestamp is not followed by channel. This could be caused by an internal error. If this packet is detected, the entire event must be rejected. However, this packet must not happened and if it does, you should contact your supplier.&lt;br /&gt;
&lt;br /&gt;
Table 4.3.10 – Error 0x9xxxxxxx&lt;br /&gt;
{| style=&amp;quot;color:black; background-color:#00ffcc;&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!31|| || || || || || || ||23|| || || || || || || || || || || || || || || || || || || || || || ||0 &lt;br /&gt;
|-&lt;br /&gt;
| 1||1||1||1|| colspan=&amp;quot;28&amp;quot; align=&amp;quot;center&amp;quot;|Invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Event Acquisition==&lt;br /&gt;
Procedure to read events is very simple. It is a question of reading the number of packet presently available by making a reading on the bus VME at the address NbrFrames. Then, a reading in burst of the number of packet available can be made. The reading of events is done in fifo mode only. This means that the reading is done always at the same address, the Event Data address.&lt;br /&gt;
&lt;br /&gt;
To start the acquisition, you must set the bit 0 of the CSR to 1. To stop the acquisition, you set the bit 0 of the CSR to 0.&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
==	Aux Output==&lt;br /&gt;
The aux_out front panel output can be set to provide a trigger output, busy output or system clock output, this function is selected by triggerconfig[3..0] and CSR[16] ...&lt;br /&gt;
&lt;br /&gt;
triggerconfig[0] = 1 sets AuxTrigDisable prevents trigger from reaching aux-out (This was for tactic)&lt;br /&gt;
triggerconfig[1] = 1 Enables the self-trigger Logic (when 0 the logic is just a a simple OR of the 6 Front End trigger requests)&lt;br /&gt;
triggerconfig[2] = 1 selects tigc trigger (rather than the self trigger)&lt;br /&gt;
triggerconfig[3] = 1 sets the system clock to aux_out (rather than trigger)&lt;br /&gt;
There is also a &amp;quot;select busy out&amp;quot; signal [CSR[16]] which overrides all the above and puts the busy signal to aux_out&lt;br /&gt;
&lt;br /&gt;
The triggerconfig register is 64bits wide, the remaining 60 bits are used to set the self-trigger logic&lt;br /&gt;
triggerconfig[39.. 4] = GroupThresholds     6 thresholds of 6 bits each (0-63)&lt;br /&gt;
triggerconfig[57..40] = FeGroups            6 groupid&#039;s of 3 bits each (0-7)&lt;br /&gt;
triggerconfig[63..58] = GroupCoincidence    6 bits, 1 bit enabling each of the 6 groups&lt;br /&gt;
&lt;br /&gt;
There are 6 frontend FPGAs with 8 channels each, each sends its trigger multiplicity (0-8) to the collector.  There are 6 possible groups to assign the frontends to (One simple scheme would be to put  all 6 in a single group - the multiplicity from this group would then be the total multiplicity on this VF48, in this case, all 6 groupids would be the same, only 1 bit would be enabled in GroupCoincidence, and only 1 multiplicity(GroupThreshold) would need to be set)&lt;br /&gt;
&lt;br /&gt;
= Signal Processing =&lt;br /&gt;
&lt;br /&gt;
The system integrates a signal processing logic which calculates the charge and the precise time where the hit has been detected. In the FE FPGA the continuous flow of digitized signal samples from the ADC is directed to the signal processing logic. The signal processor runs continuously. It performs tasks equivalent to a spectroscopy amplifier connected to an analog multi-channel analyzer.&lt;br /&gt;
&lt;br /&gt;
 [[Image:splogic.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==	Real-Time Digital Filter and Charge Evaluation==&lt;br /&gt;
&lt;br /&gt;
The filtering involves many steps. The first step is the deconvolution of the exponential tail of the pulse shape within an arbitrary time window. The moving window deconvolution method is well documented in the litterature. It is implemented as a finite impulse response filter (FIR). If D0, D1, … Dn, represent the digitized signal samples, and L the span of the moving window, the nth point of the transformed sequence Fn is given by the relation:&lt;br /&gt;
 &lt;br /&gt;
  (1)  [[Image:f1vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
where τ is the exponential time constant of the signal in units of data samples. The deconvolution is useful in the case of a germanium detector to compensate for the differences in ballistic deficit as a function of the rise time of the signal. Depending on the position of the photon interaction, the charge collection time may vary from event to event by as much as 150 nanoseconds. With a preamplifier decay time constant of 50 microseconds, this translates into a fluctuation of the raw signal peak amplitude corresponding to 3 Kev for a 1 Mev gamma. With an analog system, this fluctuation is reduced significantly by using a long filter peaking time, but it never vanishes. With the moving window deconvolution method, the tail pulse shape is transformed into a quasi-rectangular pulse shape, with a duration determined by the span of the moving window. The transformed signal has a leading edge reflecting the shape of the original signal (with a slight correction for the exponential decay), and then reaches a constant maximum value that is exactly the same for a given total charge deposited in the detector whatever the rise-time. The processed signal also returns to zero with no tail.&lt;br /&gt;
&lt;br /&gt;
It can be seen from equation (1) that the first two terms will cancel the DC baseline. However, the sum term that cancels exactly the exponential decay will unfortunately respond to a baseline level with a gain of L/τ. The sum term also limits the effectiveness of the low frequency filtering effect of the first two terms. To alleviate this problem, one can resort to double sampling, or use a baseline restoring scheme. We have chosen this later approach. The baseline restoring process is active only when no signal is present. &lt;br /&gt;
&lt;br /&gt;
At this stage, the filtering is not yet complete. Only the low frequency part of the noise spectrum has been attenuated. The high frequency filtering is performed by applying another FIR transformation to the corrected deconvoluted signal. The most efficient filter for the evaluation of the trend of a noisy straight line (the flat part of the rectangular pulse shape) is the simple floating average transformation, commonly called a boxcar filter:&lt;br /&gt;
&lt;br /&gt;
    (2) [[Image:f2vf48.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K is chosen to be as close as possible to the size of the flat portion of the rectangular pulse Fn . For a theoretical signal having a zero rise time and an exponential decay with time constant equal to τ, the sequence of points Gn  represents a trapeze with a rise time of K, a flat portion of L-K, and a fall time of K. Every point of the flat top part of the pulse is a proper evaluation of the charge. Selecting the maximum value is simple, but it generates a small average bias proportional to the noise. We rather select the measurement point at a pre-determined time after the beginning of the pulse, based on the timing information produced by the CFD discriminator. This amounts to selecting the point at random (as far as the amplitude is concerned) in the flat top region, thereby reducing the bias.&lt;br /&gt;
&lt;br /&gt;
Due to constraint design (the division by τ would involve excessive FPGA resources), we multiply both sides of equation (1) by τ (parameter M), and we do not normalize by the number of points. The result appearing in the event list  is given by&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
It can be scaled down by software when the histograms are constructed.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
==	Digital Constant Fraction Discriminator==&lt;br /&gt;
Analog constant fraction discriminators (CFD) are widely used to minimize the time walk associated with the detection of signals featuring widely varying amplitudes. The same principle can be applied to digital signal samples, with some differences in the physical implementation. In the VF48 firmware, the implementation reproduces exactly the definition of a CFD: The amplitude of the signal is evaluated, and a threshold is calculated with a predefined fraction. The same signal, delayed through a digital delay line (dual port RAM), is then compared with this calculated threshold until the point immediately below, and the point immediately above the threshold are found. Then, a linear interpolation is performed to evaluate the time corresponding to the threshold crossing. We use time units of 1/16 of the ADC sampling clock period for the interpolation. Often, the rise time is not constant from event to event, as it depends on the position where the electron-holes pairs were created in the crystal. So, it is important to clip the incoming signal to a width equal or shorter than the fastest signal rise time envisioned before the CFD logic. This is achieved by subtracting two samples separated by the proper number of sampling clocks. This has the same effect as the clipping delay line of an analog CFD. The digital CFD produces two outputs: a logic signal synchronized with the ADC clock, when the constant fraction threshold is crossed, and a higher precision time stamp word. The logic signal is used by the trigger logic, whilst the time stamp is part of the event data stream. &lt;br /&gt;
&lt;br /&gt;
==	Latency and Event Segment Buffers==&lt;br /&gt;
&lt;br /&gt;
In order to accommodate for the latency of the trigger system, a circular latency buffer is used to keep the past values of the signal samples available for a time equal or longer than the trigger decision latency. The input of the buffer is either the raw data signal, or the output of the deconvolution logic. This can be selected by a run parameter. The maximum capacity of the latency buffer is presently 512 elements. When a trigger is accepted, this delay allows the recovery of the associated signal since its very beginning. We usually also include a few samples that have occurred before the signal. The latency buffer is implemented in a dual port random access memory running continuously. The read address is equal to the write address minus the number of clock cycles we want to have the data delayed. The signal data is continuously written in the memory, and the delayed data continuously available on the readout port. When a trigger is accepted, a transfer gate is generated for a duration corresponding to the size of the data segment requested, and the data read out is transferred to the next buffer stage: the segment event buffer.  &lt;br /&gt;
&lt;br /&gt;
The segment buffer is a simple 1024 word FIFO that stores the waveform data segments, plus two extra bits indicating the beginning and end of these segments. The FIFO is read out asynchronously by the list formatter. The function of the Segment Buffer is to store a few events in order to deramdomize the data flow. The segment buffer also generates an almost full flag that is transmitted to the master trigger system. This is the mechanism that throttles the trigger rate when the data acquisition becomes throughput limited. When the throughput is significantly lower than the system bandwidth, the data acquisition is dead-timeless.&lt;br /&gt;
&lt;br /&gt;
=	Firmware Update=&lt;br /&gt;
&lt;br /&gt;
To do an update, you will need the ByteBlaster II connector connected on the parallel port of your PC and to the connector J3 on the VF48 board. (Or an USB Blaster module)&lt;br /&gt;
&lt;br /&gt;
Then, you must download the programmer on the Altera Website:&lt;br /&gt;
https://www.altera.com/support/software/download/programming/quartus2/dnl-quartus2_programmer.jsp&lt;br /&gt;
 &lt;br /&gt;
Then, you start the program. You change the mode from JTAG to Active Serial Programming. You push the Hardware Setup button and you select ByteBlaster II. Then, you push the Add File button and you select the pof file that we supplied you. After, you click in the Program/Configure case and finally you push the Start button.&lt;br /&gt;
&lt;br /&gt;
When the firmware has been programmed, you must unplug the ByteBlaster II connector from the VF48 board, shut down the power and put it back.&lt;br /&gt;
&lt;br /&gt;
If the green light is on, programming was completed successfully. If the green light is off, did you forget to unplug the ByteBlaster II connector? If no, restart all the procedure. &lt;br /&gt;
&lt;br /&gt;
==	Label Convention==&lt;br /&gt;
&lt;br /&gt;
A label convention is done to name each version that is created. It starts by the firmware main revision. Then, we add respectively the sub revision, the sampling frequency, the system clock frequency and the special features if they exist. &lt;br /&gt;
&lt;br /&gt;
For example, the name VF48_V207_X6_40_20_Alpha.pof is associated to the firmware version 2.0.7 with a sampling frequency of 40 MHz and a system frequency of 20 MHz. The special feature Alpha signifies that this version is done specifically for Alpha project.&lt;br /&gt;
&lt;br /&gt;
== Firmware history ==&lt;/div&gt;</summary>
		<author><name>Cpearson</name></author>
	</entry>
</feed>