begin
- THE_ADC_REF : entity work.pll_in200_out40
- port map(
- CLK => CLK_ADCRAW,
- CLKOP => ADCCLK_OUT,
- LOCK => lock(0)
- );
+-- THE_ADC_REF : entity work.pll_in240_out40
+-- port map(
+-- CLK => CLK_ADCRAW,
+-- CLKOP => ADCCLK_OUT,
+-- LOCK => lock(0)
+-- );
THE_ADC_PLL_0 : entity work.pll_adc10bit
port map(
port(
CLK : in std_logic;
CLK_ADCRAW : in std_logic;
-
+ CLK_RAW_LEFT : in std_logic;
+ CLK_RAW_RIGHT : in std_logic;
--ADC
ADCCLK_OUT : out std_logic;
ADC_DATA : in std_logic_vector((DEVICES_1+DEVICES_2)*(CHANNELS+1)-1 downto 0);
)
port map(
CLK => CLK,
- CLK_ADCRAW => CLK_ADCRAW,
+ CLK_ADCRAW => CLK_RAW_LEFT,
RESTART_IN => adc_restart,
ADCCLK_OUT => ADCCLK_OUT,
--FCO is another channel for each ADC
)
port map(
CLK => CLK,
- CLK_ADCRAW => CLK_ADCRAW,
+ CLK_ADCRAW => CLK_RAW_RIGHT,
RESTART_IN => adc_restart,
ADCCLK_OUT => open,
--FCO is another channel for each ADC
BUS_TX.data(31) <= config.check_word_enable;
when x"1a" => BUS_TX.data(31 downto 0) <= config.channel_disable(31 downto 0);
when x"1b" => BUS_TX.data(15 downto 0) <= config.channel_disable(47 downto 32);
- when x"1c" => BUS_TX.data(1 downto 0) <= std_logic_vector(to_unsigned(config.processing_mode,2));
+ when x"1c" => BUS_TX.data(1 downto 0) <= std_logic_vector(to_unsigned(config.processing_mode,2));
+ when x"1d" => BUS_TX.data <= (others => '0');
+ when x"1e" => BUS_TX.data <= std_logic_vector(config.baseline_fix_value);
when others => BUS_TX.ack <= '0'; BUS_TX.unknown <= '1';
end case;
elsif BUS_RX.addr >= x"0020" and BUS_RX.addr <= x"002f" then
when x"10" => config.buffer_depth <= unsigned(BUS_RX.data(10 downto 0));
when x"11" => config.samples_after <= unsigned(BUS_RX.data(10 downto 0));
when x"12" => config.block_count <= unsigned(BUS_RX.data( 1 downto 0));
- when x"13" => config.trigger_threshold <= unsigned(BUS_RX.data(17 downto 0));
+ when x"13" => config.trigger_threshold <= signed(BUS_RX.data(17 downto 0));
when x"14" => config.readout_threshold <= unsigned(BUS_RX.data(17 downto 0));
when x"15" => config.presum <= unsigned(BUS_RX.data( 7 downto 0));
when x"16" => config.averaging <= unsigned(BUS_RX.data( 3 downto 0));
when x"1a" => config.channel_disable(31 downto 0) <= BUS_RX.data(31 downto 0);
when x"1b" => config.channel_disable(47 downto 32) <= BUS_RX.data(15 downto 0);
when x"1c" => config.processing_mode <= to_integer(unsigned(BUS_RX.data(1 downto 0)));
+ when x"1e" => config.baseline_fix_value <= unsigned(BUS_RX.data);
when others => BUS_TX.ack <= '0'; BUS_TX.unknown <= '1';
end case;
elsif BUS_RX.addr >= x"0020" and BUS_RX.addr <= x"002f" then
baseline_reset_value(2) <= baseline_reset_value(3);
baseline_reset_value(1) <= baseline_reset_value(2)(23 downto 0) * resize(config.presum+1,8);
baseline_reset_value(0) <= baseline_reset_value(1);
+
+ if config.baseline_fix_value(30) = '0' then
+ config.baseline_reset_value <= baseline_reset_value(0);
+ else
+ config.baseline_reset_value <= config.baseline_fix_value(31) & '0' & config.baseline_fix_value(29 downto 0);
+ end if;
end process;
- config.baseline_reset_value <= baseline_reset_value(0);
end architecture;
buffer_depth : unsigned(10 downto 0);
samples_after : unsigned(10 downto 0);
block_count : unsigned( 1 downto 0);
- trigger_threshold : unsigned(17 downto 0);
- readout_threshold : unsigned(17 downto 0);
+ trigger_threshold : signed (17 downto 0);
+ readout_threshold : signed (17 downto 0);
presum : unsigned( 7 downto 0);
averaging : unsigned( 3 downto 0);
trigger_enable : std_logic_vector(47 downto 0);
channel_disable : std_logic_vector(47 downto 0);
baseline_always_on: std_logic;
baseline_reset_value : unsigned(31 downto 0);
+ baseline_fix_value : unsigned(31 downto 0);
block_avg : unsigned_array_8(0 to 3);
block_sums : unsigned_array_8(0 to 3);
block_scale : unsigned_array_8(0 to 3);
gen_baselines : for i in 0 to CHANNELS-1 generate
proc_baseline_calc : process begin
wait until rising_edge(CLK);
- if baseline_reset = '1' then
- baseline_averages(i) <= CONF.baseline_reset_value;
+ if baseline_reset = '1' or CONF.baseline_reset_value(31) = '1' then
+ baseline_averages(i) <= "00" & CONF.baseline_reset_value(29 downto 0);
elsif reg2_ram_remove = '1' and (reg_ram_data_out(i)(17) = '0' or CONF.baseline_always_on = '1') then
baseline_averages(i) <= baseline_averages(i)
+ resize(reg_ram_data_out(i)(15 downto 0),32)
proc_trigger : process begin
wait until rising_edge(CLK);
if ram_write = '1' then
- if (ram_data_in(i)(15 downto 0) > baseline(i) + CONF.trigger_threshold(15 downto 0) and CONF.trigger_threshold(16) = '0')
- or (ram_data_in(i)(15 downto 0) < baseline(i) + CONF.trigger_threshold(15 downto 0) and CONF.trigger_threshold(16) = '1') then
+ if (ram_data_in(i)(15 downto 0) > unsigned(signed(baseline(i)) + CONF.trigger_threshold(15 downto 0)) and CONF.trigger_threshold(16) = '0')
+ or (ram_data_in(i)(15 downto 0) < unsigned(signed(baseline(i)) + CONF.trigger_threshold(15 downto 0)) and CONF.trigger_threshold(16) = '1') then
trigger_gen(i) <= '1';
else
trigger_gen(i) <= '0';
readout_flag(i) <= '0';
end if;
- if (ram_data_in(i)(15 downto 0) > baseline(i) + CONF.readout_threshold(15 downto 0) and CONF.readout_threshold(16) = '0')
- or (ram_data_in(i)(15 downto 0) < baseline(i) + CONF.readout_threshold(15 downto 0) and CONF.readout_threshold(16) = '1') then
+ if (ram_data_in(i)(15 downto 0) > unsigned(signed(baseline(i)) + CONF.readout_threshold(15 downto 0)) and CONF.readout_threshold(16) = '0')
+ or (ram_data_in(i)(15 downto 0) < unsigned(signed(baseline(i)) + CONF.readout_threshold(15 downto 0)) and CONF.readout_threshold(16) = '1') then
reset_threshold_counter(i) <= '1';
else
reset_threshold_counter(i) <= '0';
<?xml version="1.0" encoding="UTF-8"?>
-<DiamondModule name="pll_adc10bit" module="PLL" VendorName="Lattice Semiconductor Corporation" generator="IPexpress" date="2014 02 27 18:02:54.297" version="5.3" type="Module" synthesis="" source_format="VHDL">
+<DiamondModule name="pll_adc10bit" module="PLL" VendorName="Lattice Semiconductor Corporation" generator="IPexpress" date="2016 06 10 12:38:09.421" version="5.8" type="Module" synthesis="synplify" source_format="VHDL">
<Package>
- <File name="pll_adc10bit.lpc" type="lpc" modified="2014 02 27 18:02:53.000"/>
- <File name="pll_adc10bit.vhd" type="top_level_vhdl" modified="2014 02 27 18:02:53.000"/>
- <File name="pll_adc10bit_tmpl.vhd" type="template_vhdl" modified="2014 02 27 18:02:53.000"/>
+ <File name="pll_adc10bit.lpc" type="lpc" modified="2016 06 10 12:37:47.000"/>
+ <File name="pll_adc10bit.vhd" type="top_level_vhdl" modified="2016 06 10 12:37:47.000"/>
+ <File name="pll_adc10bit_tmpl.vhd" type="template_vhdl" modified="2016 06 10 12:37:47.000"/>
</Package>
</DiamondModule>
CoreType=LPM
CoreStatus=Demo
CoreName=PLL
-CoreRevision=5.3
+CoreRevision=5.8
ModuleName=pll_adc10bit
SourceFormat=VHDL
ParameterFileVersion=1.0
-Date=02/27/2014
-Time=18:02:53
+Date=06/10/2016
+Time=12:37:47
[Parameters]
Verilog=0
IO=0
Type=ehxpllb
mode=normal
-IFrq=200
-Div=1
+IFrq=240
+Div=6
ClkOPBp=0
Post=4
U_OFrq=200
DutyTrimP=Rising
DelayMultP=0
fb_mode=Internal
-Mult=1
+Mult=5
Phase=0.0
Duty=8
DelayMultS=0
PCDR=0
FINDELA=0
VcoRate=
-Bandwidth=2.970786
+Bandwidth=1.753251
;DelayControl=No
EnCLKOS=0
ClkOSBp=0
EnCLKOK=0
ClkOKBp=0
enClkOK2=0
+
+[Command]
+cmd_line= -w -n pll_adc10bit -lang vhdl -synth synplify -arch ep5c00 -type pll -fin 240 -phase_cntl STATIC -fclkop 200 -fclkop_tol 0.0 -fb_mode INTERNAL -noclkos -noclkok -norst -noclkok2 -bw
--- VHDL netlist generated by SCUBA Diamond_2.1_Production (100)
--- Module Version: 5.3
---/d/jspc29/lattice/diamond/2.1_x64/ispfpga/bin/lin64/scuba -w -n pll_adc10bit -lang vhdl -synth synplify -arch ep5c00 -type pll -fin 200 -phase_cntl STATIC -fclkop 200 -fclkop_tol 0.0 -fb_mode INTERNAL -noclkos -noclkok -norst -noclkok2 -bw -e
+-- VHDL netlist generated by SCUBA Diamond (64-bit) 3.7.1.502
+-- Module Version: 5.7
+--/d/jspc29/lattice/diamond/3.7_x64/ispfpga/bin/lin64/scuba -w -n pll_adc10bit -lang vhdl -synth synplify -arch ep5c00 -type pll -fin 240 -phase_cntl STATIC -fclkop 200 -fclkop_tol 0.0 -fb_mode INTERNAL -noclkos -noclkok -norst -noclkok2 -bw
--- Thu Feb 27 18:02:53 2014
+-- Fri Jun 10 12:37:47 2016
library IEEE;
use IEEE.std_logic_1164.all;
CLK: in std_logic;
CLKOP: out std_logic;
LOCK: out std_logic);
- attribute dont_touch : boolean;
- attribute dont_touch of pll_adc10bit : entity is true;
end pll_adc10bit;
architecture Structure of pll_adc10bit is
attribute FREQUENCY_PIN_CLKOP : string;
attribute FREQUENCY_PIN_CLKI : string;
attribute FREQUENCY_PIN_CLKOP of PLLInst_0 : label is "200.000000";
- attribute FREQUENCY_PIN_CLKI of PLLInst_0 : label is "200.000000";
+ attribute FREQUENCY_PIN_CLKI of PLLInst_0 : label is "240.000000";
attribute syn_keep : boolean;
- attribute syn_noprune : boolean;
- attribute syn_noprune of Structure : architecture is true;
attribute NGD_DRC_MASK : integer;
attribute NGD_DRC_MASK of Structure : architecture is 1;
CLKOS_TRIM_DELAY=> 0, CLKOS_TRIM_POL=> "RISING",
CLKOP_TRIM_DELAY=> 0, CLKOP_TRIM_POL=> "RISING",
PHASE_DELAY_CNTL=> "STATIC", DUTY=> 8, PHASEADJ=> "0.0",
- CLKOK_DIV=> 2, CLKOP_DIV=> 4, CLKFB_DIV=> 1, CLKI_DIV=> 1,
- FIN=> "200.000000")
+ CLKOK_DIV=> 2, CLKOP_DIV=> 4, CLKFB_DIV=> 5, CLKI_DIV=> 6,
+ FIN=> "240.000000")
port map (CLKI=>CLK, CLKFB=>CLKFB_t, RST=>scuba_vlo,
RSTK=>scuba_vlo, WRDEL=>scuba_vlo, DRPAI3=>scuba_vlo,
DRPAI2=>scuba_vlo, DRPAI1=>scuba_vlo, DRPAI0=>scuba_vlo,