<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://ift.wiki.uib.no/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ako054</id>
	<title>ift - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://ift.wiki.uib.no/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ako054"/>
	<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/Special:Contributions/Ako054"/>
	<updated>2026-04-11T11:26:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1414</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1414"/>
		<updated>2010-10-18T19:10:44Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* LED control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;modules in control/status chain:&#039;&#039;&#039;&lt;br /&gt;
* detector module interfaces (4 -- one per chain)&lt;br /&gt;
* XA configuration (4 -- one per chain)&lt;br /&gt;
* RCU master&lt;br /&gt;
* bin control&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-9] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
synchronizes the inputs and outputs of the FPGA with the internal clock signal.&lt;br /&gt;
&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
This module generates the clock and the reset signal for the firmware components. &lt;br /&gt;
The signals are based on a crystal oscillator input and a global clock.&lt;br /&gt;
&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;br /&gt;
The time tag generator provides information about when an event happens. It maintains a 20-bit counter used to timestamp science events. The 20-bit time stamp then become part of the science data package (SCDP) .&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1413</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1413"/>
		<updated>2010-10-18T19:08:23Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Timetag generation (tt_gen) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;modules in control/status chain:&#039;&#039;&#039;&lt;br /&gt;
* detector module interfaces (4 -- one per chain)&lt;br /&gt;
* XA configuration (4 -- one per chain)&lt;br /&gt;
* RCU master&lt;br /&gt;
* bin control&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-9] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
synchronizes the inputs and outputs of the FPGA with the internal clock signal.&lt;br /&gt;
&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
This module generates the clock and the reset signal for the firmware components. &lt;br /&gt;
The signals are based on a crystal oscillator input and a global clock.&lt;br /&gt;
&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;br /&gt;
The time tag generator provides information about when an event happens. It maintains a 20-bit counter used to timestamp science events. The 20-bit time stamp then become part of the science data package (SCDP) .&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1412</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1412"/>
		<updated>2010-10-18T19:08:08Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Clock reset (clkrst) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;modules in control/status chain:&#039;&#039;&#039;&lt;br /&gt;
* detector module interfaces (4 -- one per chain)&lt;br /&gt;
* XA configuration (4 -- one per chain)&lt;br /&gt;
* RCU master&lt;br /&gt;
* bin control&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-9] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
synchronizes the inputs and outputs of the FPGA with the internal clock signal.&lt;br /&gt;
&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
This module generates the clock and the reset signal for the firmware components. &lt;br /&gt;
The signals are based on a crystal oscillator input and a global clock.&lt;br /&gt;
&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1411</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1411"/>
		<updated>2010-10-18T19:07:48Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Resync register */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;modules in control/status chain:&#039;&#039;&#039;&lt;br /&gt;
* detector module interfaces (4 -- one per chain)&lt;br /&gt;
* XA configuration (4 -- one per chain)&lt;br /&gt;
* RCU master&lt;br /&gt;
* bin control&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-9] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
synchronizes the inputs and outputs of the FPGA with the internal clock signal.&lt;br /&gt;
&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1410</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1410"/>
		<updated>2010-10-18T19:05:48Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Address decoder (adrdec_bgo) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;modules in control/status chain:&#039;&#039;&#039;&lt;br /&gt;
* detector module interfaces (4 -- one per chain)&lt;br /&gt;
* XA configuration (4 -- one per chain)&lt;br /&gt;
* RCU master&lt;br /&gt;
* bin control&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-9] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1409</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1409"/>
		<updated>2010-10-18T18:58:43Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Memory bus interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1408</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1408"/>
		<updated>2010-10-18T18:58:36Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Memory bus interface (mb_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1407</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1407"/>
		<updated>2010-10-18T18:57:26Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* MUX (scdp_ch_mux) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
The chain multiplexer receives the SCDP from readout chains (one chain contains 8 ASICS, that are 1024 channel) and writes data into the FIFO&lt;br /&gt;
&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1406</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1406"/>
		<updated>2010-10-18T18:54:21Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Binning control module (BCM) (bin_ctrl_module) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
The BCM delivers status reports of the collected data. It generates a 2D table out of SCDP coming from the pmt_if. This table includes temporal and spectral bins. Time and energy value from the SCDP are analyzed and assigned to a temporal and spectral bin. That bin value then will be incremented. &lt;br /&gt;
There are lower and higher boundaries for the spectral bin value. If the energy value in the SCDP is outside the boundaries it will be discarded. The spectral boundaries are configurable via the mb_if. The result also is delivered via mb_if. &lt;br /&gt;
&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in detector module interface&lt;br /&gt;
&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1405</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1405"/>
		<updated>2010-10-18T18:52:33Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Address decoder (adrdec_bgo) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules &lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1404</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1404"/>
		<updated>2010-10-18T18:51:25Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Address decoder (adrdec_bgo) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1403</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1403"/>
		<updated>2010-10-18T18:50:34Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* DPU interface (dpu_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1402</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1402"/>
		<updated>2010-10-18T18:49:28Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Memory bus interface (mb_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
===xlink_rx===&lt;br /&gt;
===rx register===&lt;br /&gt;
===xlink_tx===&lt;br /&gt;
===tx register===&lt;br /&gt;
===tx control fsm===&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1401</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1401"/>
		<updated>2010-10-18T18:48:20Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Hit discriminator (hit_dicr)= */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
===Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
===xlink_rx===&lt;br /&gt;
===rx register===&lt;br /&gt;
===xlink_tx===&lt;br /&gt;
===tx register===&lt;br /&gt;
===tx control fsm===&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1400</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1400"/>
		<updated>2010-10-18T18:47:47Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* XA config (xa_cfg) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
==Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
===xlink_rx===&lt;br /&gt;
===rx register===&lt;br /&gt;
===xlink_tx===&lt;br /&gt;
===tx register===&lt;br /&gt;
===tx control fsm===&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
&lt;br /&gt;
===XA register verification (xa_reg_verify)===&lt;br /&gt;
FSM, ASIC configuration register verifier&lt;br /&gt;
===RAM (dpram1k8)===&lt;br /&gt;
RAM to memorize control register, dual port RAM for volatile XA configuration data&lt;br /&gt;
===Memory bus interface===&lt;br /&gt;
===piso8_ctrl===&lt;br /&gt;
FSM&lt;br /&gt;
&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1399</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1399"/>
		<updated>2010-10-18T18:41:51Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Detector module interface (dm_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
===Offset substract===&lt;br /&gt;
Finds and subtracts the offset from ADC data, ensuring&lt;br /&gt;
a consistent mean value of zero between all four detector chains&lt;br /&gt;
&lt;br /&gt;
==Hit discriminator (hit_dicr)===&lt;br /&gt;
determines whether there was an event or not?&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
===xlink_rx===&lt;br /&gt;
===rx register===&lt;br /&gt;
===xlink_tx===&lt;br /&gt;
===tx register===&lt;br /&gt;
===tx control fsm===&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1398</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1398"/>
		<updated>2010-10-18T18:35:37Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Detector module interface (dm_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
interface to readout electroncs for the detector modules. Reads&lt;br /&gt;
energy, pixel and ASIC address, in addition to multihit information. Also&lt;br /&gt;
controls the pipelined ADC.&lt;br /&gt;
&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
===xlink_rx===&lt;br /&gt;
===rx register===&lt;br /&gt;
===xlink_tx===&lt;br /&gt;
===tx register===&lt;br /&gt;
===tx control fsm===&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1397</id>
		<title>CZT-firmware</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=CZT-firmware&amp;diff=1397"/>
		<updated>2010-10-18T18:35:06Z</updated>

		<summary type="html">&lt;p&gt;Ako054: Created page with &amp;#039;List of included modules in hierachical order:   ==Detector module interface (dm_if)== ==MUX (scdp_ch_mux)== ==FIFO== ==DPU interface (dpu_if) == ===xlink_rx=== ===rx register===…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;List of included modules in hierachical order: &lt;br /&gt;
&lt;br /&gt;
==Detector module interface (dm_if)==&lt;br /&gt;
==MUX (scdp_ch_mux)==&lt;br /&gt;
==FIFO==&lt;br /&gt;
==DPU interface (dpu_if) ==&lt;br /&gt;
===xlink_rx===&lt;br /&gt;
===rx register===&lt;br /&gt;
===xlink_tx===&lt;br /&gt;
===tx register===&lt;br /&gt;
===tx control fsm===&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module) ==&lt;br /&gt;
===Scdp channel mux===&lt;br /&gt;
===Bin address generator===&lt;br /&gt;
===Bin access control===&lt;br /&gt;
===Swing buffer===&lt;br /&gt;
===Bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==RCU master (rcumaster)==&lt;br /&gt;
===LED control===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
==XA config (xa_cfg)==&lt;br /&gt;
==Resync register==&lt;br /&gt;
==Clock reset (clkrst)==&lt;br /&gt;
==Timetag generation (tt_gen)==&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=ASIM-CZT&amp;diff=1396</id>
		<title>ASIM-CZT</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=ASIM-CZT&amp;diff=1396"/>
		<updated>2010-10-18T18:31:33Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* CZT detector */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==CZT detector==&lt;br /&gt;
&lt;br /&gt;
CZT stands for [http://en.wikipedia.org/wiki/Cadmium_zinc_telluride| Cadmium Zinc Telluride], a semiconductor material.&lt;br /&gt;
In ASIM context CZT is also the MXGS detector with imaging capability.&lt;br /&gt;
&lt;br /&gt;
==Firmware==&lt;br /&gt;
An introduction to the CZT EBB firmware can be found here: [[CZT-firmware]]&lt;br /&gt;
&lt;br /&gt;
[[Category:ASIM]]&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1386</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1386"/>
		<updated>2010-10-13T14:46:20Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Memory bus interface (mb_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29_3|mb_if ]] in Temperature Monitor&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29_3|mb_if ]] in Temperature Monitor&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1385</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1385"/>
		<updated>2010-10-13T14:45:57Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* memory bus interface (mb_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29_3|mb_if ]] in Temperature Monitor&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1384</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1384"/>
		<updated>2010-10-13T14:44:42Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* memory bus interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in BGO channel&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===Memory bus interface (mb_if)===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1383</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1383"/>
		<updated>2010-10-13T14:44:18Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* memory bus interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in BGO channel&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1382</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1382"/>
		<updated>2010-10-13T14:44:05Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* memory bus interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in BGO channel&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1381</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1381"/>
		<updated>2010-10-13T14:42:48Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* memory bus interface (mb_if) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface (mb_if)===&lt;br /&gt;
see [[#Memory_bus_interface_.28mb_if.29|mb_if ]] in BGO channel&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1380</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1380"/>
		<updated>2010-10-13T14:39:31Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* memory bus interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface (mb_if)===&lt;br /&gt;
see mb_if&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1379</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1379"/>
		<updated>2010-10-13T14:37:52Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* mb_if */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Memory bus interface (mb_if)====&lt;br /&gt;
including a control register and a fsm. basically a translator, translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1378</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1378"/>
		<updated>2010-10-13T14:37:05Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* mb_if */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
including a control register and a fsm. basically a translator. &lt;br /&gt;
&lt;br /&gt;
translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1377</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1377"/>
		<updated>2010-10-13T14:33:43Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* mb_if */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
including a control register and a fsm. basically a translator. &lt;br /&gt;
translating memory data into commands for active module and delivers status reports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input:&#039;&#039;&#039;&lt;br /&gt;
* memory address memadr_in (from adress decoder)&lt;br /&gt;
* memory data memdat_in (from address decoder, incl. command )&lt;br /&gt;
* status register sr[0-3] (from logic module, e.g. tmon)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output:&#039;&#039;&#039;&lt;br /&gt;
* memdat_out (to address decoder, incl. answer)&lt;br /&gt;
* control registers cr[0-3] (to logig module, incl. command)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general: &lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1376</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1376"/>
		<updated>2010-10-13T14:18:10Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Temperature monitor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor (tmon_struct)==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1375</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1375"/>
		<updated>2010-10-13T14:17:53Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* DPU interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface (dpu_if)==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1374</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1374"/>
		<updated>2010-10-13T14:17:28Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Binning control module (BCM) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM) (bin_ctrl_module)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1373</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1373"/>
		<updated>2010-10-13T14:16:21Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Address decoder */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder (adrdec_bgo)==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1372</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1372"/>
		<updated>2010-10-13T14:16:01Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* MUX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX (bgo_mux)==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1371</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1371"/>
		<updated>2010-10-13T14:15:39Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* BGO channel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel (bgo_channel_[0-2])==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1370</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1370"/>
		<updated>2010-10-13T14:13:02Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Address decoder */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
general:&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1369</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1369"/>
		<updated>2010-10-13T14:12:46Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Address decoder */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
* memadr_in (from dpu_if/user)&lt;br /&gt;
* memdat_out_[0-4] (from modules)&lt;br /&gt;
* clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
* memadr_out (to modules)&lt;br /&gt;
* di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1368</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1368"/>
		<updated>2010-10-13T14:11:56Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* Address decoder */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* decodes the memory_address_in (memadr_in) and delivers data to called modules (pm_if_0, pm_if_1, pm_if_2, tmon or binctrl)&lt;br /&gt;
* the module_base address (e.g. tmon_base) is defined in the mxgs_bgo_pk package.&lt;br /&gt;
* delivers answer (memdat, memory data) from modules &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;input: &#039;&#039;&#039;&lt;br /&gt;
memadr_in (from dpu_if/user)&lt;br /&gt;
memdat_out_X (from modules)&lt;br /&gt;
clk etc. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;output: &#039;&#039;&#039;&lt;br /&gt;
memadr_out (to modules)&lt;br /&gt;
di_memdat_in (to dpu_if)&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1367</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1367"/>
		<updated>2010-10-01T13:27:10Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* temperature monitor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_if)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1366</id>
		<title>BGO-firmware-structure</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=BGO-firmware-structure&amp;diff=1366"/>
		<updated>2010-10-01T13:26:50Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* temperature monitor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BGO channel==&lt;br /&gt;
There are 3 BGO channels, each interfacing one PMT. Each BGO channel is hosting an own FIFO to store the event data. The readout of the fifos is controlled by the MUX block. &lt;br /&gt;
&lt;br /&gt;
===PMT interface===&lt;br /&gt;
PMT = photo multiplyer tube&lt;br /&gt;
&lt;br /&gt;
Taks: collects the ADC data from the detector, creates science data packets (SCDP) ans stores the data in a fifo.&lt;br /&gt;
tasks included: lowpass filter, offset correction, tail estimation, shaping, peak detect, trigger &amp;amp; control.&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2009 by yngve (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
included blocks:&lt;br /&gt;
====pmt_if_ctrl====&lt;br /&gt;
is a fsm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port (&lt;br /&gt;
      arst_n       : in  std_logic;     -- asynchronous reset&lt;br /&gt;
      rst          : in  std_logic;     -- synchronous reset&lt;br /&gt;
      clk          : in  std_logic;&lt;br /&gt;
      diff_trig    : in  std_logic;     -- differential trigger&lt;br /&gt;
      ovf          : in  std_logic;     -- ADC overflow&lt;br /&gt;
      peak         : in  std_logic;     -- peak found&lt;br /&gt;
      val_trig     : in  std_logic;     -- value trigger&lt;br /&gt;
      fast         : in  std_logic;     -- pulse ocurred on the tail of another pulse&lt;br /&gt;
      offset_lock  : in  std_logic;     -- offset is found&lt;br /&gt;
      load         : out std_logic;     -- load scdp&lt;br /&gt;
      offset_en    : out std_logic;     -- offset enable&lt;br /&gt;
      acc_en       : in  std_logic;     -- baseline correction enable&lt;br /&gt;
      hug          : out std_logic;     -- release the peak hold register&lt;br /&gt;
      par_clr      : out std_logic;     -- clear paralyzation flag&lt;br /&gt;
      inhibit      : in  std_logic;     -- inhibit further triggers&lt;br /&gt;
      smalltrig_en : in  std_logic;     -- enable small triggers&lt;br /&gt;
      adc_en       : out std_logic;     -- ADC enable&lt;br /&gt;
      smpl_mode    : in  std_logic;     -- direct sampling mode&lt;br /&gt;
      fifo_full    : in  std_logic;     -- fifo full flag&lt;br /&gt;
      fifo_empty   : in  std_logic;     -- fifo empty flag&lt;br /&gt;
      smpl_trig    : out std_logic      -- feedthrough of ADC data to FIFO&lt;br /&gt;
      );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====mb_if====&lt;br /&gt;
Memory bus interface. &lt;br /&gt;
&lt;br /&gt;
including a control register and a fsm&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* by yngve 2008&lt;br /&gt;
&lt;br /&gt;
====mov_avrg and mov_avrg8====&lt;br /&gt;
moving avarage.&lt;br /&gt;
&lt;br /&gt;
is a type of finite impulse response filter used to analyze a set of data points by creating a series of averages of different subsets of the full data set.&lt;br /&gt;
(http://en.wikipedia.org/wiki/Moving_average)&lt;br /&gt;
&lt;br /&gt;
====tailgen====&lt;br /&gt;
&lt;br /&gt;
pulse tail cancellation in order to reduction of systems dead time. several filters. &lt;br /&gt;
&lt;br /&gt;
two separate tail estimation filters are used to enable tail cancellation of several consecutive pule tails. they will be used alternately, outputs are summed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
find document &amp;quot;BGO extention&amp;quot; written by yngve for further details.&lt;br /&gt;
&lt;br /&gt;
====tailgen_ctrl====&lt;br /&gt;
&lt;br /&gt;
is a fsm. selcting a trigger?&lt;br /&gt;
output= &#039;tg_sel&#039; being 0 or 1&lt;br /&gt;
&lt;br /&gt;
===FIFO===&lt;br /&gt;
stores SCDP per channel &lt;br /&gt;
&lt;br /&gt;
FIFO1k48&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
&lt;br /&gt;
==MUX==&lt;br /&gt;
coordinates data which should be read out from fifos. &lt;br /&gt;
... interface to the 3 fifos included in BGO_channels&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib&lt;br /&gt;
* 2010 by magne (auto)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
port( &lt;br /&gt;
        arst_n      : in     std_logic;                         -- asynchronous reset&lt;br /&gt;
        clk         : in     std_logic;                         -- clock&lt;br /&gt;
        fifo_read   : in     std_logic;                         -- read fifo from current chain&lt;br /&gt;
        data_na     : out    std_logic;                         -- data not available&lt;br /&gt;
        ch1_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 1&lt;br /&gt;
        ch2_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 2&lt;br /&gt;
        ch3_data    : in     std_logic_vector ( 47 downto 0 );  -- scdp from chain 3&lt;br /&gt;
        dout        : out    std_logic_vector ( 47 downto 0 );  -- arbitrated data&lt;br /&gt;
        sfifo_empty : in     std_logic_vector (1 to 3);&lt;br /&gt;
        sfifo_read  : out    std_logic_vector (1 to 3)&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Address decoder==&lt;br /&gt;
memory bus address decoder and data multiplexor&lt;br /&gt;
&lt;br /&gt;
* mxgs_bgo_lib &lt;br /&gt;
* 2008 by yngve&lt;br /&gt;
&lt;br /&gt;
==Binning control module (BCM)==&lt;br /&gt;
&lt;br /&gt;
the BCM generates a 2D table out of SCDP coming from the pmt_if. the table includes  temporal and spectral bins. time and energy value from the SCDP are analysed and assigned to a temporal and spectral bin. that binvalue then will be incremented. &lt;br /&gt;
&lt;br /&gt;
there are lower and higher bondaries for the spectral bin value. if the energy value in the SCDP  is outside that boundaries it will be discarded. the spectral boundaries are configurable via the mb_if. &lt;br /&gt;
-&amp;gt; some kind of filter&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
included modules:&lt;br /&gt;
&lt;br /&gt;
===scdp channel mux===&lt;br /&gt;
===bin address generator===&lt;br /&gt;
===bin access control===&lt;br /&gt;
===swing buffer===&lt;br /&gt;
===bin module address arbiter===&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
&lt;br /&gt;
==DPU interface==&lt;br /&gt;
is interfacing the DPU emulator, input: commands, output: data, status&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 port (&lt;br /&gt;
    clk               : in  std_logic;  -- clock&lt;br /&gt;
    arst_n            : in  std_logic;  -- asynchronous reset    &lt;br /&gt;
    memdat_in         : in  std_logic_vector(7 downto 0);  -- memory bus data input&lt;br /&gt;
    serial_data_in    : in  std_logic;  -- serial data input&lt;br /&gt;
    serial_strobe_in  : in  std_logic;  -- serial strobe input&lt;br /&gt;
    serial_data_out   : out std_logic;  -- serial data output&lt;br /&gt;
    serial_strobe_out : out std_logic;  -- serial strobe output&lt;br /&gt;
    RnW               : out std_logic;  -- read / write control&lt;br /&gt;
    ld_memdat         : out std_logic;  -- load memory data&lt;br /&gt;
    memadr_out        : out std_logic_vector(13 downto 0);  -- memory address&lt;br /&gt;
    memdat_out        : out std_logic_vector(7 downto 0);   -- memory data&lt;br /&gt;
    scdp              : in  std_logic_vector(47 downto 0);  -- scdp input&lt;br /&gt;
    enable            : in  std_logic;  -- enable input from DPU&lt;br /&gt;
    fifo_empty        : in  std_logic;  -- fifo empty indicator&lt;br /&gt;
    fifo_read         : out std_logic;  -- fifo read enable&lt;br /&gt;
    fifo_full         : in  std_logic := &#039;0&#039;);  -- fifo full indicator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===receiving:===&lt;br /&gt;
====xlink_rx====&lt;br /&gt;
Description: receiver for &amp;quot;xlink&amp;quot;, a serial data strobe encoded point to&lt;br /&gt;
-- point communications protocol for the ASIM MXGS&lt;br /&gt;
&lt;br /&gt;
====rx register====&lt;br /&gt;
reception register for DPU interface&lt;br /&gt;
&lt;br /&gt;
===transmission:===&lt;br /&gt;
&lt;br /&gt;
====xlink_tx====&lt;br /&gt;
fsm&lt;br /&gt;
====tx register====&lt;br /&gt;
transmission register for DPU interface&lt;br /&gt;
====tx control fsm====&lt;br /&gt;
&lt;br /&gt;
==Temperature monitor==&lt;br /&gt;
used for temperature compensation and housekeeping&lt;br /&gt;
controls external MUX and a ADC.&lt;br /&gt;
&lt;br /&gt;
===temperature monitor===&lt;br /&gt;
General description : This module is designed to control an analog mux and an ADC to capture&lt;br /&gt;
values from three different analog sources, in this case termistor values for temperature &lt;br /&gt;
meseurements.&lt;br /&gt;
&lt;br /&gt;
This module connects to the standard internal bus interface in the CZT/BGO firmware. It controls an external analog MUX and an ADC to sample three analog values representing temperatures.&lt;br /&gt;
when the ADC data in a channel passes a certain limit an alarm is set. the limit is set by the user in the interface via the control register (mb_bin)&lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
&lt;br /&gt;
===memory bus interface===&lt;br /&gt;
for communication with user interface. &lt;br /&gt;
&lt;br /&gt;
* asim_common_lib&lt;br /&gt;
* 2008 by yngve (auto)&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1365</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1365"/>
		<updated>2010-10-01T13:15:12Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===subprograms===&lt;br /&gt;
&lt;br /&gt;
subprograms are &#039;&#039;&#039;procedures&#039;&#039;&#039;, a collection of statements executed for their effect, and &#039;&#039;&#039;functions&#039;&#039;&#039;, a collection of statements to compute a result.&lt;br /&gt;
&lt;br /&gt;
====procedures====&lt;br /&gt;
variables etc. defined in the header are local variables. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
procedure proc_name is&lt;br /&gt;
 variable total : real :=0.0; --this is a local variable!&lt;br /&gt;
 begin&lt;br /&gt;
  for index in samples loop&lt;br /&gt;
   total = total +sample(index);&lt;br /&gt;
  end loop;&lt;br /&gt;
 answer:=total;&lt;br /&gt;
end procedure proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
procedures without parameters is called by it&#039;s name from any place in architecture. &lt;br /&gt;
other procedures can also call procedures in their body.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it is possible to use procedures with parameters.&lt;br /&gt;
&lt;br /&gt;
====functions====&lt;br /&gt;
generalization of expressions, combined values with operators and produce new values. the type of result is specified. &lt;br /&gt;
 &amp;lt;pre&amp;gt; &lt;br /&gt;
function limit (val, min, max: integer) return integer is&lt;br /&gt;
begin &lt;br /&gt;
 if val &amp;gt; max then&lt;br /&gt;
  return max;&lt;br /&gt;
 elseif val &amp;lt; min then&lt;br /&gt;
  return min;&lt;br /&gt;
 else&lt;br /&gt;
  return val;&lt;br /&gt;
 end if;&lt;br /&gt;
end function;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
a function is called in the architecture like this: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newval := limit(current_val, 10, 100);&lt;br /&gt;
newval2 := 2 + limit(current_val, 10, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
the can be written along with entities and architecture and are analyzed separately. &lt;br /&gt;
it is also possible to place a package in an other library, in that case the lib &amp;quot;work&amp;quot; has to be replaced by the lib including the package. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
====package declaration====&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model.&lt;br /&gt;
it defines the interface to a package. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====package body====&lt;br /&gt;
no package body is needed if pkg declaration contains other kinds of declarations like types, signals or fully specified constants. in case of subprograms body needed to fill in missing informations. &lt;br /&gt;
&lt;br /&gt;
items declared in body must include full declaration of subprograms as they are in the pkg declaration. that means that types, modes, default constants... must bee repeated exactly.&lt;br /&gt;
&lt;br /&gt;
===components===&lt;br /&gt;
to build hierarchical designs, used to describe interconnections in subsystems in a design.&lt;br /&gt;
component declarations are written in the declarative part of the architecture (before the &#039;&#039;begin&#039;&#039;).&lt;br /&gt;
it is an alternative to use entity declarations (see structural design).&lt;br /&gt;
an entity declaration defines a real module, it&#039;s a separate design. a component declaration defines a virtual module in the architecture  body. &amp;quot;for this architecture we assume there is a module specified by this component&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===configurations===&lt;br /&gt;
in a configuration file the declaration can be made in which case which entity is using which architecture. the architectures may vary e.g. in case of simulation or synthesis. &lt;br /&gt;
A &#039;&#039;&#039;configuration declaration&#039;&#039;&#039; is a design unit which can be compiled separately. In a configuration declaration the binding of all components which are part of a certain entity can be specified.&lt;br /&gt;
also generic maps can be set. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
configuration config_identifier of entity_name is&lt;br /&gt;
  for architecture_name&lt;br /&gt;
    &lt;br /&gt;
    for all : component_identifier&lt;br /&gt;
      use entity lib_name.entity_name2(architecture_name2); --binding_indication&lt;br /&gt;
    end for;&lt;br /&gt;
    &lt;br /&gt;
    for bgo_channel_1 : bgo_channel&lt;br /&gt;
      use entity mxgs_bgo_lib.bgo_channel(struct)&lt;br /&gt;
        generic map(&lt;br /&gt;
          g_bgo_channel =&amp;gt; &amp;quot;01&amp;quot;&lt;br /&gt;
          );&lt;br /&gt;
    end for;&lt;br /&gt;
  &lt;br /&gt;
  end for;&lt;br /&gt;
end config_identifier;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1364</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1364"/>
		<updated>2010-10-01T12:31:01Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===subprograms===&lt;br /&gt;
&lt;br /&gt;
subprograms are &#039;&#039;&#039;procedures&#039;&#039;&#039;, a collection of statements executed for their effect, and &#039;&#039;&#039;functions&#039;&#039;&#039;, a collection of statements to compute a result.&lt;br /&gt;
&lt;br /&gt;
====procedures====&lt;br /&gt;
variables etc. defined in the header are local variables. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
procedure proc_name is&lt;br /&gt;
 variable total : real :=0.0; --this is a local variable!&lt;br /&gt;
 begin&lt;br /&gt;
  for index in samples loop&lt;br /&gt;
   total = total +sample(index);&lt;br /&gt;
  end loop;&lt;br /&gt;
 answer:=total;&lt;br /&gt;
end procedure proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
procedures without parameters is called by it&#039;s name from any place in architecture. &lt;br /&gt;
other procedures can also call procedures in their body.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it is possible to use procedures with parameters.&lt;br /&gt;
&lt;br /&gt;
====functions====&lt;br /&gt;
generalization of expressions, combined values with operators and produce new values. the type of result is specified. &lt;br /&gt;
 &amp;lt;pre&amp;gt; &lt;br /&gt;
function limit (val, min, max: integer) return integer is&lt;br /&gt;
begin &lt;br /&gt;
 if val &amp;gt; max then&lt;br /&gt;
  return max;&lt;br /&gt;
 elseif val &amp;lt; min then&lt;br /&gt;
  return min;&lt;br /&gt;
 else&lt;br /&gt;
  return val;&lt;br /&gt;
 end if;&lt;br /&gt;
end function;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
a function is called in the architecture like this: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newval := limit(current_val, 10, 100);&lt;br /&gt;
newval2 := 2 + limit(current_val, 10, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
the can be written along with entities and architecture and are analyzed separately. &lt;br /&gt;
it is also possible to place a package in an other library, in that case the lib &amp;quot;work&amp;quot; has to be replaced by the lib including the package. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
====package declaration====&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model.&lt;br /&gt;
it defines the interface to a package. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====package body====&lt;br /&gt;
no package body is needed if pkg declaration contains other kinds of declarations like types, signals or fully specified constants. in case of subprograms body needed to fill in missing informations. &lt;br /&gt;
&lt;br /&gt;
items declared in body must include full declaration of subprograms as they are in the pkg declaration. that means that types, modes, default constants... must bee repeated exactly.&lt;br /&gt;
&lt;br /&gt;
===components===&lt;br /&gt;
to build hierarchical designs, used to describe interconnections in subsystems in a design.&lt;br /&gt;
component declarations are written in the declarative part of the architecture (before the &#039;&#039;begin&#039;&#039;).&lt;br /&gt;
it is an alternative to use entity declarations (see structural design).&lt;br /&gt;
an entity declaration defines a real module, it&#039;s a separate design. a component declaration defines a virtual module in the architecture  body. &amp;quot;for this architecture we assume there is a module specified by this component&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===configurations===&lt;br /&gt;
in a configuration file the declaration can be made in which case which entity is using which architecture. the architectures may vary e.g. in case of simulation or synthesis. &lt;br /&gt;
A &#039;&#039;&#039;configuration declaration&#039;&#039;&#039; is a design unit which can be compiled separately. In a configuration declaration the binding of all components which are part of a certain entity can be specified.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
configuration config_identifier of entity_name is&lt;br /&gt;
  for architecture_name&lt;br /&gt;
    &lt;br /&gt;
    for all : component_identifier&lt;br /&gt;
      use entity lib_name.entity_name2(architecture_name2); --binding_indication&lt;br /&gt;
    end for;&lt;br /&gt;
    &lt;br /&gt;
    for bgo_channel_1 : bgo_channel&lt;br /&gt;
      use entity mxgs_bgo_lib.bgo_channel(struct)&lt;br /&gt;
        generic map(&lt;br /&gt;
          g_bgo_channel =&amp;gt; &amp;quot;01&amp;quot;&lt;br /&gt;
          );&lt;br /&gt;
    end for;&lt;br /&gt;
  &lt;br /&gt;
  end for;&lt;br /&gt;
end config_identifier;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1362</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1362"/>
		<updated>2010-09-29T14:27:33Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===subprograms===&lt;br /&gt;
&lt;br /&gt;
subprograms are &#039;&#039;&#039;procedures&#039;&#039;&#039;, a collection of statements executed for their effect, and &#039;&#039;&#039;functions&#039;&#039;&#039;, a collection of statements to compute a result.&lt;br /&gt;
&lt;br /&gt;
====procedures====&lt;br /&gt;
variables etc. defined in the header are local variables. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
procedure proc_name is&lt;br /&gt;
 variable total : real :=0.0; --this is a local variable!&lt;br /&gt;
 begin&lt;br /&gt;
  for index in samples loop&lt;br /&gt;
   total = total +sample(index);&lt;br /&gt;
  end loop;&lt;br /&gt;
 answer:=total;&lt;br /&gt;
end procedure proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
procedures without parameters is called by it&#039;s name from any place in architecture. &lt;br /&gt;
other procedures can also call procedures in their body.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it is possible to use procedures with parameters.&lt;br /&gt;
&lt;br /&gt;
====functions====&lt;br /&gt;
generalization of expressions, combined values with operators and produce new values. the type of result is specified. &lt;br /&gt;
 &amp;lt;pre&amp;gt; &lt;br /&gt;
function limit (val, min, max: integer) return integer is&lt;br /&gt;
begin &lt;br /&gt;
 if val &amp;gt; max then&lt;br /&gt;
  return max;&lt;br /&gt;
 elseif val &amp;lt; min then&lt;br /&gt;
  return min;&lt;br /&gt;
 else&lt;br /&gt;
  return val;&lt;br /&gt;
 end if;&lt;br /&gt;
end function;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
a function is called in the architecture like this: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newval := limit(current_val, 10, 100);&lt;br /&gt;
newval2 := 2 + limit(current_val, 10, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
the can be written along with entities and architecture and are analyzed separately. &lt;br /&gt;
it is also possible to place a package in an other library, in that case the lib &amp;quot;work&amp;quot; has to be replaced by the lib including the package. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
====package declaration====&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model.&lt;br /&gt;
it defines the interface to a package. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====package body====&lt;br /&gt;
no package body is needed if pkg declaration contains other kinds of declarations like types, signals or fully specified constants. in case of subprograms body needed to fill in missing informations. &lt;br /&gt;
&lt;br /&gt;
items declared in body must include full declaration of subprograms as they are in the pkg declaration. that means that types, modes, default constants... must bee repeated exactly.&lt;br /&gt;
&lt;br /&gt;
===components===&lt;br /&gt;
to build hierarchical designs, used to describe interconnections in subsystems in a design.&lt;br /&gt;
component declarations are written in the declarative part of the architecture (before the &#039;&#039;begin&#039;&#039;).&lt;br /&gt;
it is an alternative to use entity declarations (see structural design).&lt;br /&gt;
an entity declaration defines a real module, it&#039;s a separate design. a component declaration defines a virtual module in the architecture  body. &amp;quot;for this architecture we assume there is a module specified by this component&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1361</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1361"/>
		<updated>2010-09-29T14:10:18Z</updated>

		<summary type="html">&lt;p&gt;Ako054: /* components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===subprograms===&lt;br /&gt;
&lt;br /&gt;
subprograms are &#039;&#039;&#039;procedures&#039;&#039;&#039;, a collection of statements executed for their effect, and &#039;&#039;&#039;functions&#039;&#039;&#039;, a collection of statements to compute a result.&lt;br /&gt;
&lt;br /&gt;
====procedures====&lt;br /&gt;
variables etc. defined in the header are local variables. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
procedure proc_name is&lt;br /&gt;
 variable total : real :=0.0; --this is a local variable!&lt;br /&gt;
 begin&lt;br /&gt;
  for index in samples loop&lt;br /&gt;
   total = total +sample(index);&lt;br /&gt;
  end loop;&lt;br /&gt;
 answer:=total;&lt;br /&gt;
end procedure proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
procedures without parameters is called by it&#039;s name from any place in architecture. &lt;br /&gt;
other procedures can also call procedures in their body.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it is possible to use procedures with parameters.&lt;br /&gt;
&lt;br /&gt;
====functions====&lt;br /&gt;
generalization of expressions, combined values with operators and produce new values. the type of result is specified. &lt;br /&gt;
 &amp;lt;pre&amp;gt; &lt;br /&gt;
function limit (val, min, max: integer) return integer is&lt;br /&gt;
begin &lt;br /&gt;
 if val &amp;gt; max then&lt;br /&gt;
  return max;&lt;br /&gt;
 elseif val &amp;lt; min then&lt;br /&gt;
  return min;&lt;br /&gt;
 else&lt;br /&gt;
  return val;&lt;br /&gt;
 end if;&lt;br /&gt;
end function;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
a function is called in the architecture like this: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newval := limit(current_val, 10, 100);&lt;br /&gt;
newval2 := 2 + limit(current_val, 10, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
the can be written along with entities and architecture and are analyzed separately. &lt;br /&gt;
it is also possible to place a package in an other library, in that case the lib &amp;quot;work&amp;quot; has to be replaced by the lib including the package. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
====package declaration====&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model.&lt;br /&gt;
it defines the interface to a package. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====package body====&lt;br /&gt;
no package body is needed if pkg declaration contains other kinds of declarations like types, signals or fully specified constants. in case of subprograms body needed to fill in missing informations. &lt;br /&gt;
&lt;br /&gt;
items declared in body must include full declaration of subprograms as they are in the pkg declaration. that means that types, modes, default constants... must bee repeated exactly.&lt;br /&gt;
&lt;br /&gt;
===components===&lt;br /&gt;
to build hierarchical designs, used to describe interconnections in subsystems in a design.&lt;br /&gt;
component declarations are written in the declarative part of the architecture (before the &#039;&#039;&#039;&#039;&#039;begin&#039;&#039;&#039;&#039;&#039;).&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1360</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1360"/>
		<updated>2010-09-29T13:55:01Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===subprograms===&lt;br /&gt;
&lt;br /&gt;
subprograms are &#039;&#039;&#039;procedures&#039;&#039;&#039;, a collection of statements executed for their effect, and &#039;&#039;&#039;functions&#039;&#039;&#039;, a collection of statements to compute a result.&lt;br /&gt;
&lt;br /&gt;
====procedures====&lt;br /&gt;
variables etc. defined in the header are local variables. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
procedure proc_name is&lt;br /&gt;
 variable total : real :=0.0; --this is a local variable!&lt;br /&gt;
 begin&lt;br /&gt;
  for index in samples loop&lt;br /&gt;
   total = total +sample(index);&lt;br /&gt;
  end loop;&lt;br /&gt;
 answer:=total;&lt;br /&gt;
end procedure proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
procedures without parameters is called by it&#039;s name from any place in architecture. &lt;br /&gt;
other procedures can also call procedures in their body.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it is possible to use procedures with parameters.&lt;br /&gt;
&lt;br /&gt;
====functions====&lt;br /&gt;
generalization of expressions, combined values with operators and produce new values. the type of result is specified. &lt;br /&gt;
 &amp;lt;pre&amp;gt; &lt;br /&gt;
function limit (val, min, max: integer) return integer is&lt;br /&gt;
begin &lt;br /&gt;
 if val &amp;gt; max then&lt;br /&gt;
  return max;&lt;br /&gt;
 elseif val &amp;lt; min then&lt;br /&gt;
  return min;&lt;br /&gt;
 else&lt;br /&gt;
  return val;&lt;br /&gt;
 end if;&lt;br /&gt;
end function;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
a function is called in the architecture like this: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newval := limit(current_val, 10, 100);&lt;br /&gt;
newval2 := 2 + limit(current_val, 10, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
the can be written along with entities and architecture and are analyzed separately. &lt;br /&gt;
it is also possible to place a package in an other library, in that case the lib &amp;quot;work&amp;quot; has to be replaced by the lib including the package. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
====package declaration====&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model.&lt;br /&gt;
it defines the interface to a package. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====package body====&lt;br /&gt;
no package body is needed if pkg declaration contains other kinds of declarations like types, signals or fully specified constants. in case of subprograms body needed to fill in missing informations. &lt;br /&gt;
&lt;br /&gt;
items declared in body must include full declaration of subprograms as they are in the pkg declaration. that means that types, modes, default constants... must bee repeated exactly.&lt;br /&gt;
&lt;br /&gt;
===components===&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1359</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1359"/>
		<updated>2010-09-29T13:30:29Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===subprograms===&lt;br /&gt;
&lt;br /&gt;
subprograms are &#039;&#039;&#039;procedures&#039;&#039;&#039;, a collection of statements executed for their effect, and &#039;&#039;&#039;functions&#039;&#039;&#039;, a collection of statements to compute a result.&lt;br /&gt;
&lt;br /&gt;
====procedures====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
procedure proc_name is&lt;br /&gt;
 variable total : real :=0.0;&lt;br /&gt;
 begin&lt;br /&gt;
  for index in samples loop&lt;br /&gt;
   total = total +sample(index);&lt;br /&gt;
  end loop;&lt;br /&gt;
 answer:=total;&lt;br /&gt;
end procedure proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
procedures without parameters is called by it&#039;s name from any place in architecture. &lt;br /&gt;
other procedures can also call procedures in their body.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it is possible to use procedures with parameters.&lt;br /&gt;
&lt;br /&gt;
====functions====&lt;br /&gt;
generalization of expressions, combined values with operators and produce new values. the type of result is specified. &lt;br /&gt;
 &amp;lt;pre&amp;gt; &lt;br /&gt;
function limit (val, min, max: integer) return integer is&lt;br /&gt;
begin &lt;br /&gt;
 if val &amp;gt; max then&lt;br /&gt;
  return max;&lt;br /&gt;
 elseif val &amp;lt; min then&lt;br /&gt;
  return min;&lt;br /&gt;
 else&lt;br /&gt;
  return val;&lt;br /&gt;
 end if;&lt;br /&gt;
end function;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
a function is called in the architecture like this: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newval := limit(current_val, 10, 100);&lt;br /&gt;
newval2 := 2 + limit(current_val, 10, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
the can be written along with entities and architecture and are analyzed separately. &lt;br /&gt;
it is also possible to place a package in an other library, in that case the lib &amp;quot;work&amp;quot; has to be replaced by the lib including the package. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1358</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1358"/>
		<updated>2010-09-29T13:29:46Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===subprograms===&lt;br /&gt;
&lt;br /&gt;
subprograms are &#039;&#039;&#039;procedures&#039;&#039;&#039;, a collection of statements executed for their effect, and &#039;&#039;&#039;functions&#039;&#039;&#039;, a collection of statements to compute a result.&lt;br /&gt;
&lt;br /&gt;
====procedures====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
procedure proc_name is&lt;br /&gt;
 variable total : real :=0.0;&lt;br /&gt;
 begin&lt;br /&gt;
  for index in samples loop&lt;br /&gt;
   total = total +sample(index);&lt;br /&gt;
  end loop;&lt;br /&gt;
 answer:=total;&lt;br /&gt;
end procedure proc_name;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
procedures without parameters is called by it&#039;s name from any place in architecture. &lt;br /&gt;
other procedures can also call procedures in their body.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proc_name;&lt;br /&gt;
&amp;lt;/per&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it is possible to use procedures with parameters.&lt;br /&gt;
&lt;br /&gt;
====functions====&lt;br /&gt;
generalization of expressions, combined values with operators and produce new values. the type of result is specified. &lt;br /&gt;
 &amp;lt;pre&amp;gt; &lt;br /&gt;
function limit (val, min, max: integer) return integer is&lt;br /&gt;
begin &lt;br /&gt;
 if val &amp;gt; max then&lt;br /&gt;
  return max;&lt;br /&gt;
 elseif val &amp;lt; min then&lt;br /&gt;
  return min;&lt;br /&gt;
 else&lt;br /&gt;
  return val;&lt;br /&gt;
 end if;&lt;br /&gt;
end function;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
a function is called in the architecture like this: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
newval := limit(current_val, 10, 100);&lt;br /&gt;
newval2 := 2 + limit(current_val, 10, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
the can be written along with entities and architecture and are analyzed separately. &lt;br /&gt;
it is also possible to place a package in an other library, in that case the lib &amp;quot;work&amp;quot; has to be replaced by the lib including the package. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1357</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1357"/>
		<updated>2010-09-29T09:41:49Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Packages===&lt;br /&gt;
&lt;br /&gt;
grouping  a collection of related declarations to serve common purpose.&lt;br /&gt;
seperat design units that can be worked on independently, reused in different parts of design. &lt;br /&gt;
&lt;br /&gt;
the external view is specified in the &#039;&#039;&#039;package declaration&#039;&#039;&#039;, the implementation is defind in the &#039;&#039;&#039;package body&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
the package declaration hosts type, constand, subprogram, signal ... declarations which are shared within the model. in the model then you just need to refer to the package: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package yourpackagename is --declaration&lt;br /&gt;
 constant foo: std_logic_vector(7 downto 0) := X&amp;quot;01&amp;quot;;&lt;br /&gt;
 type  foobar is array (foobar2) of somethingelse;&lt;br /&gt;
end package yourpackagename;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
use yourpackagename.all;&lt;br /&gt;
&lt;br /&gt;
entity yourentityname is&lt;br /&gt;
 port (&lt;br /&gt;
  fooport    : in work.yourpackagename.foo;&lt;br /&gt;
  foobarport : in work.yourpackagename.foobar;&lt;br /&gt;
 );&lt;br /&gt;
end entity yourentityname;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1356</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1356"/>
		<updated>2010-09-28T17:50:22Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIBRARY ieee;&lt;br /&gt;
USE ieee.std_logic_1164.ALL;&lt;br /&gt;
&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(&lt;br /&gt;
  a,b : in  std_logic;   &lt;br /&gt;
  q   : out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
begin&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end basic;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
 begin&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture struct;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
	<entry>
		<id>http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1355</id>
		<title>VHDL</title>
		<link rel="alternate" type="text/html" href="http://ift.wiki.uib.no/index.php?title=VHDL&amp;diff=1355"/>
		<updated>2010-09-28T16:31:16Z</updated>

		<summary type="html">&lt;p&gt;Ako054: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Modeling concept==&lt;br /&gt;
there are 3 domains of  modeling:&lt;br /&gt;
* function&lt;br /&gt;
* structure&lt;br /&gt;
* geometry&lt;br /&gt;
&lt;br /&gt;
each provides a basic modeling concept.&lt;br /&gt;
&lt;br /&gt;
a module e.g. a register is an &#039;&#039;&#039;entity&#039;&#039;&#039;, it&#039;s inputs ans outputs are called &#039;&#039;&#039;ports&#039;&#039;&#039;. &lt;br /&gt;
an &#039;&#039;&#039;architecture&#039;&#039;&#039; is the internal implementation of an entity. it describes the behavior of an entity. &lt;br /&gt;
architectures includes only &#039;&#039;&#039;processes&#039;&#039;&#039;, collection of actions which are executed in sequences. &lt;br /&gt;
&lt;br /&gt;
types of action that can be performed: &lt;br /&gt;
* evaluating expressions&lt;br /&gt;
* assigning variables and values&lt;br /&gt;
* conditional and repeated execution&lt;br /&gt;
* subprogram calls&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;behavioral architecture&#039;&#039;&#039;&#039;&#039;: function of an entity is described in an abstract way. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port ( s,r : in  std_logic;&lt;br /&gt;
      q,qb : out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture behave of calc is&lt;br /&gt;
begin&lt;br /&gt;
 foo: process&lt;br /&gt;
 begin&lt;br /&gt;
    Q &amp;lt;= S nand QB;&lt;br /&gt;
    QB &amp;lt;= R nand Q;  &lt;br /&gt;
 end process  foo;&lt;br /&gt;
end architecture behave;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;structural architecture&#039;&#039;&#039;&#039;&#039;: only interconnecting subsystems&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity nand2 is&lt;br /&gt;
port(a,b: in  std logic; &lt;br /&gt;
       q: out std_logic);&lt;br /&gt;
end nand2;&lt;br /&gt;
&lt;br /&gt;
architecture basic of nand2 is&lt;br /&gt;
q &amp;lt;= a nand b after 2 ns;&lt;br /&gt;
end architecture nand2;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
entity srlatch is&lt;br /&gt;
port( s,r: in  std logic; &lt;br /&gt;
     q,qb: out std_logic);&lt;br /&gt;
end srlatch;&lt;br /&gt;
&lt;br /&gt;
architecture struct of srlatch is&lt;br /&gt;
&lt;br /&gt;
 sq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; s,&lt;br /&gt;
   b =&amp;gt; qb,&lt;br /&gt;
   q =&amp;gt; q&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
 rq: entity work.nand2(basic)&lt;br /&gt;
 port map (&lt;br /&gt;
   a =&amp;gt; r,&lt;br /&gt;
   b =&amp;gt; q,&lt;br /&gt;
   q =&amp;gt; qb&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
end architecture srlatch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ako054</name></author>
	</entry>
</feed>