Commit 02c4dba5 authored by egousiou's avatar egousiou

1st version evas; major changes in units: wf_rx_osc and wf_rx

git-svn-id: http://svn.ohwr.org/cern-fip/trunk/hdl/design@56 7f0067c9-7624-46c7-bd39-3fb5400c0213
parent 3f7da556
This diff is collapsed.
......@@ -65,23 +65,30 @@ use IEEE.NUMERIC_STD.all; --! conversion functions
entity deglitcher is
Generic (C_ACULENGTH : integer := 10);
Port ( uclk_i : in STD_LOGIC;
d_i : in STD_LOGIC;
d_o : out STD_LOGIC;
rx_data_i : in STD_LOGIC;
clk_bit_180_p_i : in std_logic;
rx_data_filtered_o : out STD_LOGIC;
carrier_p_i : in STD_LOGIC;
d_ready_p_o : out STD_LOGIC);
sample_manch_bit_p_o : out STD_LOGIC;
sample_bit_p_o : out STD_LOGIC
);
end deglitcher;
architecture Behavioral of deglitcher is
signal s_onesc : signed(C_ACULENGTH - 1 downto 0);
signal s_rx_data_filtered_o: STD_LOGIC;
signal s_d_d: std_logic_vector(2 downto 0);
signal s_rx_data_filtered_d : std_logic;
begin
process(uclk_i)
begin
if rising_edge(uclk_i) then
if carrier_p_i = '1' then
if carrier_p_i = '1' then -- 4 clock ticks after a transition of manchestered input
s_onesc <= to_signed(0,s_onesc'length);
elsif d_i = '1' then
elsif rx_data_i = '1' then
s_onesc <= s_onesc - 1;
else
s_onesc <= s_onesc + 1;
......@@ -89,14 +96,68 @@ if rising_edge(uclk_i) then
end if;
end process;
process(uclk_i)
begin if rising_edge(uclk_i) then
begin
if rising_edge(uclk_i) then
if carrier_p_i = '1' then
d_o <= s_onesc(s_onesc'left);
s_rx_data_filtered_o <= s_onesc(s_onesc'left);
end if;
d_ready_p_o <= carrier_p_i;
s_rx_data_filtered_d <= s_rx_data_filtered_o;
end if;
end process;
sample_manch_bit_p_o <= carrier_p_i;
sample_bit_p_o <= clk_bit_180_p_i;
--process(carrier_p_i)
--begin
--if rising_edge(carrier_p_i) then
-- s_rx_data_filtered_o <= s_onesc(s_onesc'left);
-- elsif falling_edge(carrier_p_i) then
-- s_rx_data_filtered_o <= s_onesc(s_onesc'left);
-- end if;
-- end process;
--process(uclk_i)
--begin
--if rising_edge(uclk_i) then
-- sample_manch_bit_p_o <= carrier_p_i;
-- sample_bit_p_o <= clk_bit_180_p_i; ---- delay on clk_bit_180_p_i, so that sample_bit is 1 clock tick before rx_data_filtered_o
-- s_rx_data_filtered_o_1 <= s_rx_data_filtered_o_0;
-- s_rx_data_filtered_o_0 <= s_rx_data_filtered_o;
-- end if;
--end process;
rx_data_filtered_o <= s_rx_data_filtered_d;
end Behavioral;
-------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--! @file dpblockram.vhd
-------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--! Standard library
library IEEE;
--! Standard packages
use IEEE.STD_LOGIC_1164.all; --! std_logic definitions
use IEEE.NUMERIC_STD.all; --! conversion functions
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
-- --
-- CERN, BE --
-- --
-------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
--
-- unit name: dpblockram.vhd
--
--! @brief The dpblockram implements a template for a true dual port ram clocked on both ports by the same clock.
--! @brief The unit provides transparently to the outside world the memory triplication and all the
--! associated actions.
--!
--!
--! @author <Pablo Alvarez(pablo.alvarez.sanchez@cern.ch)>
--
--! @date 24\01\2009
--
--! @version 1
--
--! @details
--!
--! <b>Dependencies:</b>\n
--! @details The component DualClkRam is triplicated.
--! Each incoming byte is written at the same position in the three memories, whereas
--! each outgoing byte is the outcome of a majority voting system from the three memories.
--!
--! <b>Dependencies:</b>\n
--! DualClkRAM.vhd \n
--!
--! <b>References:</b>\n
--! <reference one> \n
--! <reference two>
--!
--! <b>Modified by:</b>\n
--! Author: Pablo Alvarez Sanchez (pablo.alvarez.sanchez@cern.ch)
-------------------------------------------------------------------------------
--! \n\n<b>Last changes:</b>\n
--! 24\01\2009 paas header included\n
--! <extended description>
-------------------------------------------------------------------------------
--! @todo Adapt vhdl sintax to ohr standard\n
--! <another thing to do> \n
---------------------------------------------------------------------------------------------------
--! @todo
--
-------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
entity dpblockram_clka_rd_clkb_wr is
generic (c_dl : integer := 8; -- Length of the data word
c_al : integer := 9); -- Number of words
-- 'nw' has to be coherent with 'c_al'
generic (c_data_length : integer := 8; -- 8: length of data word
c_addr_length : integer := 9); -- 2^9: memory depth
port (
clka_i : in std_logic; -- Global Clock
aa_i : in std_logic_vector(c_al - 1 downto 0);
da_o : out std_logic_vector(c_dl -1 downto 0);
clkb_i : in std_logic;
ab_i : in std_logic_vector(c_al - 1 downto 0);
db_i : in std_logic_vector(c_dl - 1 downto 0);
web_i : in std_logic);
clk_A_i : in std_logic;
addr_A_i : in std_logic_vector(c_addr_length - 1 downto 0);
clk_B_i : in std_logic;
addr_B_i : in std_logic_vector(c_addr_length - 1 downto 0);
data_B_i : in std_logic_vector(c_data_length - 1 downto 0);
write_en_B_i : in std_logic;
data_A_o : out std_logic_vector(c_data_length -1 downto 0)
);
end dpblockram_clka_rd_clkb_wr;
--library synplify;
--use synplify.attributes.all;
architecture syn of dpblockram_clka_rd_clkb_wr is
component DualClkRam is
port( DINA : in std_logic_vector(7 downto 0); DOUTA : out
std_logic_vector(7 downto 0); DINB : in std_logic_vector(
7 downto 0); DOUTB : out std_logic_vector(7 downto 0);
ADDRA : in std_logic_vector(8 downto 0); ADDRB : in
std_logic_vector(8 downto 0);RWA, RWB, BLKA, BLKB, CLKA,
CLKB, RESET : in std_logic) ;
end component DualClkRam;
---------------------------------------------------------------------------------------------------
--!@brief: component DualClkRam declaration
component DualClkRam is
port(
DINA : in std_logic_vector(7 downto 0);
ADDRA : in std_logic_vector(8 downto 0);
RWA : in std_logic;
CLKA : in std_logic;
DINB : in std_logic_vector(7 downto 0);
ADDRB : in std_logic_vector(8 downto 0);
RWB : in std_logic;
CLKB : in std_logic;
RESETn : in std_logic;
DOUTA : out std_logic_vector(7 downto 0);
DOUTB : out std_logic_vector(7 downto 0)
);
end component DualClkRam;
---------------------------------------------------------------------------------------------------
signal s_zeros_da : std_logic_vector(7 downto 0);
signal zero : std_logic;
signal one : std_logic;
signal s_rw : std_logic;
type t_da_o_array is array (natural range <>) of std_logic_vector(7 downto 0);
signal da_o_array : t_da_o_array(0 to 2);
signal s_rwB : std_logic;
signal s_zeros : std_logic_vector(7 downto 0);
type t_data_o_A_array is array (natural range <>) of std_logic_vector(7 downto 0);
signal data_o_A_array : t_data_o_A_array(0 to 2); --will keep the DOUTA of each one of the memories
---------------------------------------------------------------------------------------------------
begin
s_zeros_da <= (others => '0');
zero <= '0';
one <= '1';
s_rw <= not web_i;
s_zeros <= (others => '0');
s_rwB <= not write_en_B_i;
---------------------------------------------------------------------------------------------------
--!@brief: memory triplication
--! The component DualClkRam is generated three times.
--! Port A is used for reading, port B for writing.
--! The input DINB is written in the same position in the 3 memories.
--! The output DOUTA from each memory is kept in the array data_o_A_array.
memory_triplication: for I in 0 to 2 generate
G: for I in 0 to 2 generate
UDualClkRam : DualClkRam
port map ( DINA => s_zeros_da,
DOUTA => da_o_array(I),
DINB => db_i,
DOUTB => open,
ADDRA => aa_i,
ADDRB => ab_i,
port map ( DINA => s_zeros,
ADDRA => addr_A_i,
RWA => one,
RWB => s_rw,
BLKA => zero,
BLKB => zero,
CLKA => clka_i,
CLKB => clkb_i,
RESET => one) ;
CLKA => clk_A_i,
DINB => data_B_i,
ADDRB => addr_B_i,
RWB => s_rwB,
CLKB => clk_B_i,
RESETn => one,
DOUTA => data_o_A_array(I),
DOUTB => open) ;
end generate;
process(da_o_array)
--UDualClkRam : DualClkRam
-- port map ( DINA => s_zeros,
-- ADDRA => addr_A_i,
-- RWA => one,
-- CLKA => clk_A_i,
--
-- DINB => data_B_i,
-- ADDRB => addr_B_i,
-- RWB => s_rwB,
-- CLKB => clk_B_i,
--
-- RESETn => one,
--
-- DOUTA => data_A_o,
-- DOUTB => open) ;
---------------------------------------------------------------------------------------------------
--!@brief: majority voter after a memory reading
--! when a reading is done from the memory, the process majority_voter considers internally the
--! outputs of the three memories and defines as final output, the majority of the three.
majority_voter: process (data_o_A_array)
begin
da_o <= (da_o_array(0) and da_o_array(1)) or (da_o_array(1) and da_o_array(2)) or (da_o_array(2) and da_o_array(0));
data_A_o <= (data_o_A_array(0) and data_o_A_array(1)) or
(data_o_A_array(1) and data_o_A_array(2)) or
(data_o_A_array(2) and data_o_A_array(0));
end process;
end syn;
\ No newline at end of file
This diff is collapsed.
......@@ -93,7 +93,7 @@ begin
process(s_rstin_d,var_i)
begin
if (var_i = c_var_array(c_var_reset_pos).var) then
if (var_i = c_var_array(c_reset_var_pos).var) then
s_reload_rst_c <= '1';
else
s_reload_rst_c <= s_rstin_d(s_rstin_d'left);
......
This diff is collapsed.
......@@ -59,11 +59,9 @@ generic(
port (
uclk_i : in std_logic; --! User Clock
rst_i : in std_logic;
start_p_i : in std_logic;
d_i : in std_logic;
d_rdy_p_i : in std_logic;
data_fcs_sel_n : in std_logic;
d_i : in std_logic;
crc_o : out std_logic_vector(c_poly_length - 1 downto 0);
crc_rdy_p_o : out std_logic;
crc_ok_p : out std_logic
......@@ -95,10 +93,10 @@ begin
s_d <= d_i;
G: for I in 0 to c_poly'left generate
G0: if I = 0 generate
s_q_nx(I) <= data_fcs_sel_n and (( s_d) xor s_q(s_q'left));
s_q_nx(I) <= (( s_d) xor s_q(s_q'left));
end generate;
G1: if I > 0 generate
s_q_nx(I) <= s_q(I-1) xor (c_poly(I) and data_fcs_sel_n and (s_d xor s_q(s_q'left)));
s_q_nx(I) <= s_q(I-1) xor (c_poly(I) and (s_d xor s_q(s_q'left)));
end generate;
end generate;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment