📄 新建 文本文档.txt
字号:
clk1_multiply_by => clock_boost_calc (input_data_rate, inclock_period, deserialization_factor, inclock_boost),
clk1_divide_by => deserialization_factor,
clk0_phase_shift => get_phase_delay (inclock_data_alignment),
device_family => intended_device_family)
port map
( inclk(0) => rx_inclock, inclk (1) => temp_zero, clkena(0) => mercury_boost_en, clkena(1 to 5) => temp_high,
clk(0) => mercury_pll_clk0_boost, clk(1) => mercury_pll_clk1_boost, clk (2 to 5) => temp_clk,
locked => mercury_locked_int_boost );
end generate YEAGER_PLL;
MERCURY_PLL:
if intended_device_family /= "Stratix" generate
U2: altclklock -- MERCURY PLL with inclock_boost
generic map
( inclock_period => inclock_period,
clock0_boost => inclock_boost, clock1_boost => inclock_boost,
clock1_divide => deserialization_factor,
valid_lock_cycles => 3,
intended_device_family => intended_device_family)
port map
( inclock => rx_inclock, inclocken => mercury_boost_en,
clock0 => mercury_pll_clk0_boost, clock1 => mercury_pll_clk1_boost,
locked => mercury_locked_int_boost );
end generate MERCURY_PLL;
msg: process
begin
if (intended_device_family = "APEX20KE" or intended_device_family = "APEX20KC" or
intended_device_family = "EXCALIBUR_ARM" or intended_device_family = "EXCALIBUR_MIPS") and
(deserialization_factor /= 4) and (deserialization_factor /= 7) and (deserialization_factor /= 8) then
ASSERT FALSE
REPORT "APEX20KE does not support the specified deserialization factor!"
SEVERITY ERROR;
elsif (intended_device_family = "MERCURY") and
(((deserialization_factor > 12) and (deserialization_factor /= 14)
and (deserialization_factor /= 16) and (deserialization_factor /= 18)
and (deserialization_factor /= 20)) or (deserialization_factor<3)) then
ASSERT FALSE
REPORT "MERCURY does not support the specified deserialization factor!"
SEVERITY ERROR;
elsif ((intended_device_family = "APEXII" or intended_device_family = "APEX II")) and
((deserialization_factor > 10) or (deserialization_factor < 4)) then
ASSERT FALSE
REPORT "APEXII does not support the specified deserialization factor!"
SEVERITY ERROR;
end if;
wait;
end process;
hssi_clkout: process (rx_clock0_int, mercury_pll_clk1)
variable posedge_count: integer := 0;
begin
if deserialization_factor rem 2 = 0 then
rx_mercury_slow_clock <= mercury_pll_clk1;
else
if mercury_pll_clk1'event and mercury_pll_clk1 = '1' then
posedge_count := 0;
rx_mercury_slow_clock <= mercury_pll_clk1;
end if;
if rx_clock0_int'event and rx_clock0_int = '1' then
posedge_count := posedge_count+1;
end if;
if rx_clock0_int'event and (rx_clock0_int = '1') and (posedge_count=(deserialization_factor+1)/2+1) then
rx_mercury_slow_clock <= NOT rx_mercury_slow_clock;
end if;
end if;
end process;
load_data: process(rx_clock0_int, rx_clock1_int, rx_deskew)
variable edge_count: integer := 0;
variable rxin_cnt: integer := 0;
variable count: channel_cnt := (others => 0);
variable sample: integer;
variable start_data : integer := 0;
variable init_deskew_pattern : boolean := true;
variable check_deskew_pattern : boolean := false;
variable deskew_pattern : std_logic_vector(deserialization_factor-1 downto 0);
variable pattern : std_logic_vector(deserialization_factor*number_of_channels -1 downto 0);
variable data_int : std_logic_vector(deserialization_factor*number_of_channels -1 downto 0);
begin
if rx_data_align_reg = '0' then
if deserialization_factor > 1 then
-- At start up deskew is done due to inability to detect unconnected
-- rx_deskew pin.
if (rx_deskew'event and rx_deskew = '1' and ( intended_device_family = "APEX20KE" or
intended_device_family = "APEX20KC" or intended_device_family = "EXCALIBUR_ARM" or
intended_device_family = "EXCALIBUR_MIPS" or
(intended_device_family = "APEXII" or intended_device_family = "APEX II" or intended_device_family="Stratix")) ) then
deskew_done <= (others => '0');
calibrate <= (others => '1');
end if;
if rx_clock1_int'event and rx_clock1_int = '1' then
if rx_deskew = '0' then
calibrate <= (others => '0');
end if;
edge_count := 0;
-- Deskewing is only for APEX20KE/APEXII LVDS mode.
-- Initialise calibration pattern variables.
if init_deskew_pattern = true then
init_deskew_pattern := false;
if (((intended_device_family = "APEK20KE") or (intended_device_family = "APEX20KC") or
(intended_device_family = "EXCALIBUR_ARM") or (intended_device_family = "EXCALIBUR_MIPS")) and
((deserialization_factor = 4) or (deserialization_factor = 7) or (deserialization_factor = 8))) then
check_deskew_pattern := true;
case deserialization_factor is
when 8 => deskew_pattern := "00111100";
when 7 => deskew_pattern := "0011100";
when 4 => deskew_pattern := "1100";
when others =>
ASSERT FALSE
REPORT "APEX20KE does not support the specified deserialization factor!"
SEVERITY ERROR;
end case;
elsif (((intended_device_family = "APEXII" or intended_device_family = "APEX II" or intended_device_family="Stratix" )) and
(deserialization_factor <= 10) and (deserialization_factor >= 4)) then
check_deskew_pattern := true;
if (cds_mode = "SINGLE_BIT") then
case deserialization_factor is
when 10 => deskew_pattern := "0001111100";
when 9 => deskew_pattern := "000111100";
when 8 => deskew_pattern := "00111100";
when 7 => deskew_pattern := "0011100";
when 6 => deskew_pattern := "011100";
when 5 => deskew_pattern := "01100";
when 4 => deskew_pattern := "1100";
when others =>
ASSERT FALSE
REPORT "APEXII does not support the specified deserialization factor!"
SEVERITY ERROR;
end case;
else
case deserialization_factor is
when 10 => deskew_pattern := "0101010101";
when 9 => deskew_pattern := "010101010";
when 8 => deskew_pattern := "01010101";
when 7 => deskew_pattern := "0101010";
when 6 => deskew_pattern := "010101";
when 5 => deskew_pattern := "01010";
when 4 => deskew_pattern := "0101";
when others =>
ASSERT FALSE
REPORT "APEXII does not support the specified deserialization factor!"
SEVERITY ERROR;
end case;
end if;
else
check_deskew_pattern := false;
end if;
end if;
if (check_deskew_pattern = true) then
for i in 0 to number_of_channels-1 loop
if calibrate(i) = '1' then
if ((pattern(((deserialization_factor*(i+1))-1) downto deserialization_factor*i) = deskew_pattern) or
((pattern(((deserialization_factor*(i+1))-1) downto deserialization_factor*i) = not deskew_pattern) and
((intended_device_family = "APEXII" or intended_device_family = "APEX II" or intended_device_family="Stratix" )) and (cds_mode = "MULTIPLE_BIT"))) then
count(i) := count(i) + 1;
else
count(i) := 0;
end if;
if count(i) >= 3 and rx_deskew = '0' then
deskew_done(i) <= '1' after ((inclock_period/deserialization_factor)*2 ps);
end if;
end if;
end loop;
else
deskew_done <= (others => '1');
end if;
end if;
if rx_clock0_int'event and rx_clock0_int = '0' then
edge_count := edge_count + 1;
if edge_count = 3 then
data_out <= data_int;
start_data := 1;
rxin_cnt := 0;
end if;
if start_data = 1 then
sample := rxin_cnt rem deserialization_factor;
rxin_cnt := rxin_cnt + 1;
for i in 0 to number_of_channels -1 loop
if deskew_done(i) = '1' then
-- Data gets shifted into MSB first.
data_int(((i+1)*deserialization_factor)-sample-1) := rx_in(i);
else
pattern(((i+1)*deserialization_factor)-sample-1) := rx_in(i);
data_int(((i+1)*deserialization_factor)-sample-1) := 'X';
end if;
end loop;
end if;
end if;
else
if rx_clock1_int'event and rx_clock1_int = '1' then
data_out <= rx_in;
end if;
end if;
end if;
end process;
parallel_reg: process(rx_clock1_int)
begin
if deserialization_factor > 1 then
if rx_clock1_int = '1' then
rx_out_rgd <= rx_out_int;
elsif (rx_clock1_int = '0') and ((deserialization_factor > 2) and (deserialization_factor < 7)) then
rx_hold_rgd <= data_out;
end if;
else
if rx_clock1_int = '1' then
rx_out_rgd <= rx_in;
end if;
end if;
end process parallel_reg;
end behavior;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -