Commit 3e530e6c authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana Committed by Tomasz Wlostowski

Moved sync chain out of gc_glitch_filt, added gc_glitch_filt doc

To make the design more modular, moved the synchronization chain out of
the gc_glitch_filt component. Made the necessary changes in the
components using the gc_glitch_filt.

Also added gc_glitch_filt documentation.
Signed-off-by: Theodor-Adrian Stana's avatarTheodor Stana <t.stana@cern.ch>
parent 4f7196cf
FILE=gc_glitch_filt
all:
$(MAKE) -C fig
pdflatex -synctex=1 -interaction=nonstopmode $(FILE).tex *.tex
bibtex $(FILE).aux
pdflatex -synctex=1 -interaction=nonstopmode $(FILE).tex *.tex
pdflatex -synctex=1 -interaction=nonstopmode $(FILE).tex *.tex
evince $(FILE).pdf &
clean:
$(MAKE) -C fig clean
rm -rf *.aux *.dvi *.log $(FILE).pdf *.lof *.lot *.out *.toc *.bbl *.blg *.gz
Type 'make' to create your .pdf documentation file.
You need Inkscape to make the documentation files:
sudo apt-get install inkscape
\ No newline at end of file
\begin{titlepage}
\vspace*{3cm}
\noindent{\LARGE \textbf{Glitch filter}}
\noindent \rule{\textwidth}{.1cm}
\hfill March 3, 2014
\vspace*{3cm}
\begin{figure}[h]
\includegraphics[height=3cm]{fig/cern-logo}
\hfill
\includegraphics[height=3cm]{fig/ohwr-logo}
\end{figure}
\vfill
\noindent {\Large \textbf{Theodor-Adrian Stana (CERN/BE-CO-HT)}}
\noindent \rule{\textwidth}{.05cm}
\end{titlepage}
SRC = $(wildcard *.svg)
OBJS = $(SRC:.svg=.pdf)
all: $(OBJS)
echo $(OBJS)
%.pdf : %.svg
inkscape -f $< -A $@
clean :
rm -f *.pdf
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="184.252px" height="184.252px" viewBox="0 0 184.252 184.252" enable-background="new 0 0 184.252 184.252"
xml:space="preserve">
<g>
<path fill="#0053A1" d="M38.544,76.536c-0.921,0.7-4.123,2.692-8.941,2.692c-8.718,0-14.658-5.495-14.658-13.872
c0-8.328,6.298-13.87,14.862-13.87c3.332,0,7.147,1.026,9.275,1.939c-0.445,0.985-0.811,2.286-0.965,3.1l-0.233,0.077
c-1.647-1.823-4.295-3.402-8.213-3.402c-4.972,0-10.696,4.027-10.696,12.056c0,7.819,5.832,11.974,11.046,11.974
c4.684,0,6.927-2.186,8.939-3.885l0.154,0.154L38.544,76.536z"/>
<path fill="#0053A1" d="M60.139,77.312c0-0.588,0.05-1.193,0.092-1.487c-2.644,0.243-9.903,0.463-12.734,0.504
c-0.048-0.707-0.11-9.091-0.04-10.387c1.132,0,7.114,0.078,9.787,0.35c-0.077-0.388-0.116-0.962-0.116-1.35
c0-0.387,0.039-1.082,0.116-1.469c-2.286,0.193-5.214,0.387-9.787,0.387c0-0.969,0.079-8.037,0.118-9.701
c5.036,0,9.596,0.313,12.148,0.504c-0.042-0.264-0.092-0.807-0.092-1.337c0-0.528,0.035-0.958,0.092-1.322
c-1.342,0.09-5.678,0.195-8.003,0.195c-2.324,0-5.913-0.078-8.237-0.195c0.154,3.294,0.311,6.664,0.311,9.997v6.664
c0,3.333-0.156,6.704-0.311,10.075c2.363-0.117,5.99-0.194,8.354-0.194c0.111,0,0.227,0,0.343,0
c0.81,0.003,1.835,0.014,2.893,0.033c1.833,0.034,3.767,0.089,5.159,0.161l0,0l0,0C60.173,78.331,60.139,77.899,60.139,77.312z"/>
<path fill="#0053A1" d="M68.815,65.622v3.082c0,3.332,0.154,6.701,0.311,10.034c-0.66-0.117-1.852-0.128-2.096-0.128
c-0.243,0-1.435,0.012-2.094,0.128c0.155-3.333,0.31-6.703,0.31-10.034v-6.666c0-3.332-0.155-6.703-0.31-10.035
c1.473,0.117,3.336,0.195,4.809,0.195c1.473,0,2.945-0.195,4.417-0.195c4.379,0,8.39,1.293,8.39,6.169
c0,5.161-5.14,7.013-8.085,7.401c1.899,2.363,8.7,10.646,10.947,13.165c-0.774-0.117-2.073-0.128-2.427-0.128
c-0.354,0-1.691,0.012-2.427,0.128c-1.531-2.335-6.437-9.686-9.77-13.117C70.688,65.621,68.815,65.622,68.815,65.622z
M71.411,64.204c3.199-0.065,7.4-1.081,7.4-5.502c0-3.852-3.371-5.076-6.005-5.076c-1.782,0-2.945,0.116-3.758,0.193
c-0.117,2.829-0.232,5.428-0.232,8.218c0,0,0,1.851,0,2.131C69.2,64.221,71.016,64.21,71.411,64.204z"/>
<path fill="#0053A1" d="M112.594,51.99c-0.453,0.078-1.013,0.142-1.699,0.142c-0.676,0-1.257-0.073-1.651-0.142
c0.17,3.174,0.462,9.047,0.462,12.899c0,2.898,0,5.428-0.04,6.862c-1.409-1.499-17.576-18.23-19.219-20.016l-1.269-0.013
c0.057,2.465,0.129,5.141,0.129,10.022c0,6.249-0.087,12.896-0.406,16.994c0.453-0.079,1.012-0.142,1.698-0.142
c0.677,0,1.257,0.071,1.65,0.142c-0.169-3.173-0.461-9.048-0.461-12.898c0-2.899,0.002-5.882,0.041-7.314
c1.409,1.5,17.667,18.458,19.218,20.561l1.269,0.012c-0.058-2.465-0.129-5.234-0.129-10.116
C112.187,62.734,112.275,56.085,112.594,51.99z"/>
<path fill="#0053A1" d="M42.069,121.789c-7.614-12.048-9.781-23.679-10.084-32.58c-1.173,0-2.346,0-3.519,0
c0.295,9.71,2.65,19.893,7.919,29.872C37.627,120.083,40.544,121.358,42.069,121.789z"/>
<path fill="#0053A1" d="M184.25,1.679c0,0-87.554-0.694-115.47-0.679c-4.369,0.003-7.302,0.311-8.248,0.371
C26.048,3.605,0.115,33.842,0,66.817c-0.032,9.586,2.522,20.39,6.667,34.973c5.476,19.267,11.891,41.367,11.891,41.367h3.499
L9.128,99.539l0.097-0.065c9.497,18.347,31.392,33.086,56.237,33.086c13.407,0,25.841-3.753,35.638-10.666l0.085,0.08
l-57.516,61.204h4.492c0,0,40.387-42.968,54.125-57.556c10.527-11.178,15.996-18.381,18.285-22.119
c2.625-4.287,10.964-16.645,10.652-34.847l0.112-0.008l25.203,114.529h3.618c0,0-21.146-93.744-25.25-113.349
c-4.038-19.292-8.809-31.258-13.957-38.083c-1.769-0.985-4.527-2.107-5.828-2.411c7.472,9.428,13.055,23.454,13.055,37.489
c0,34.355-27.95,62.304-62.306,62.304c-34.354,0-62.304-27.949-62.304-62.304c0-34.356,28.05-62.306,62.324-62.306
c15.235,0,29.356,5.588,40.209,14.79c2.098,0.29,4.91,0.945,6.589,1.551l0.013-0.035C104.902,13.046,95.163,7.265,84.33,4.225
c0-0.084,0-0.089,0-0.089l99.922,0.623L184.25,1.679z"/>
<path fill="#0053A1" d="M50.808,132.873c-2.228-0.329-5.011-1.118-6.685-1.836c7.5,8.536,17.82,15.366,27.953,19.198l2.659-2.821
C63.744,143.702,55.756,137.737,50.808,132.873"/>
<path fill="#0053A1" d="M142.469,127.885c-11.121,13.615-28.388,22.783-48.226,22.771c-4.259-0.001-8.391-0.478-11.836-1.179
l-2.847,3.022c5.445,1.258,10.271,1.731,14.885,1.731c20.405,0,37.861-9.523,48.972-22.057L142.469,127.885"/>
<path fill="#0053A1" d="M165.644,17.304l-6.001,61.965h-0.113c-0.851-11.696-6.682-25.666-13.883-34.498
c-12.5-15.329-30.842-24.585-51.444-24.585c-19.647,0-37.15,8.717-49.192,22.381l2.758,2.186
C59.145,31.888,75.442,23.643,94.2,23.643c22.836,0,41.439,11.704,51.845,27.615c9.286,14.197,12.365,32.39,10.213,45.719
c-0.727,4.502-2.36,13.257-8.359,23.176l1.05,4.614c7.358-11.405,11.091-21.556,14.005-47.503
c2.234-19.906,6.073-59.962,6.073-59.962L165.644,17.304z"/>
</g>
</svg>
This diff is collapsed.
This diff is collapsed.
@misc{ohwr,
title = {{Open Hardware Repository}},
howpublished = {\url{http://www.ohwr.org/}}
}
@misc{gencores-ohwr,
title = {{Platform-independent Core Collection webage on Open Hardware Repository}},
howpublished = {\url{http://www.ohwr.org/projects/general-cores/wiki}}
}
%==============================================================================
% Document header
%==============================================================================
\documentclass[a4paper,11pt]{article}
% Color package
\usepackage[usenames,dvipsnames]{color}
% Hyperrefs
\usepackage[
colorlinks = true,
linkcolor = Mahogany,
citecolor = Mahogany,
urlcolor = blue,
]{hyperref}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{longtable}
% Header and footer customization
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[L]{\nouppercase{\leftmark}}
\fancyhead[R]{}
\renewcommand{\footrulewidth}{0.4pt}
%==============================================================================
% Start of document
%==============================================================================
\begin{document}
%------------------------------------------------------------------------------
% Title
%------------------------------------------------------------------------------
\include{cern-title}
%------------------------------------------------------------------------------
% Revision history
%------------------------------------------------------------------------------
\thispagestyle{empty}
\section*{Revision history}
\centerline
{
\begin{tabular}{l c p{.6\textwidth}}
\hline
\multicolumn{1}{c}{\textbf{Date}} & \multicolumn{1}{c}{\textbf{Version}} & \multicolumn{1}{c}{\textbf{Change}} \\
\hline
03-03-2014 & 0.01 & First draft \\
\hline
\end{tabular}
}
%------------------------------------------------------------------------------
% Generate TOC and pagebreak after it
%------------------------------------------------------------------------------
\pagebreak
\pagenumbering{roman}
\setcounter{page}{1}
\tableofcontents
%------------------------------------------------------------------------------
% List of figs, tables, abbrevs
%------------------------------------------------------------------------------
\listoffigures
\listoftables
%------------------------------------------------------------------------------
% List of abbreviations
%------------------------------------------------------------------------------
\pagebreak
\section*{List of Abbreviations}
\begin{tabular}{l l}
FF & Flip-Flop \\
\end{tabular}
%==============================================================================
% SEC: Intro
%==============================================================================
\pagebreak
\pagenumbering{arabic}
\setcounter{page}{1}
\section{Introduction}
\label{sec:intro}
This document presents the \textit{gc\_glitch\_filt} component, a modular glitch
filter open-hardware~\cite{ohwr} design for FPGA or ASIC implementation. It is
implemented as one short VHDL file which can be found under the following folder
of the \textit{general-cores} repository~\cite{gencores-ohwr}:
\begin{itemize}
\item \textit{modules/common/}
\end{itemize}
%==============================================================================
% SEC: Instantiation
%==============================================================================
\section{Instantiation}
\label{sec:instantiation}
Table~\ref{tbl:ports} shows the instantiation template for the \textit{gc\_glitch\_filt}
component. It can be directly instantiated in a VHDL or Verilog design.
The data to be filtered should be connected to the \textit{dat\_i} input. Note that
the data is not synchronized internally to the \textit{clk\_i} signal, if metastability
is a concern, a synchronization chain should be provided outside the component.
The deglitched data is presented at the \textit{dat\_o} output a number of \textit{g\_len+1}
clock cycles later.
\begin{table}[h]
\caption{Ports and generics of \textit{gc\_i2c\_slave} module}
\label{tbl:ports}
\centerline
{
\begin{tabular}{l p{.7\textwidth}}
\hline
\multicolumn{1}{c}{\textbf{Name}} & \multicolumn{1}{c}{\textbf{Description}} \\
\hline
g\_len & Glitch filter length generic (in \textit{clk\_i} cycles) \newline
1 -- glitches narrower than 1 \textit{clk\_i} cycle are filtered \newline
2 -- glitches narrower than 2 \textit{clk\_i} cycles are filtered \newline
etc.\\
clk\_i & Clock input \\
rst\_n\_i & Active-low reset input \\
dat\_i & Data input (should be synchronous to \textit{clk\_i})\\
dat\_o & Deglitched data output (synchronous to \textit{clk\_i}) \\
\hline
\end{tabular}
}
\end{table}
%==============================================================================
% SEC: implem
%==============================================================================
\pagebreak
\section{Implementation and operation}
Figure~\ref{fig:implem} shows the implementation of the \textit{gc\_glitch\_filt}
block.
\begin{figure}[h]
\centerline{\includegraphics[width=\textwidth]{fig/implem}}
\caption{Implementation of the \textit{gc\_glitch\_filt} block}
\label{fig:implem}
\end{figure}
The block's operation is very simple and can be summarized as follows. At synthesis
time, \textit{g\_len} FFs are generated. If the \textit{dat\_i} is stable for a number
of \textit{g\_len} cycles, all FFs in the deglitching stage have the same value,
and the \textit{dat\_o} output changes to reflect the state of \textit{dat\_i}.
Should a glitch occur at any time on the \textit{dat\_i} signal, it is filtered
by the AND (or NAND) gate at the output.
All the FFs are cleared ('0') on reset.
%==============================================================================
% Bibliography
%==============================================================================
\pagebreak
\bibliographystyle{ieeetr}
\bibliography{gc_glitch_filt}
\end{document}
......@@ -6,7 +6,7 @@
\noindent \rule{\textwidth}{.1cm}
\hfill\today
\hfill February 12, 2014
\vspace*{3cm}
......
......@@ -51,6 +51,7 @@
\hline
26-06-2013 & 0.01 & First draft \\
28-10-2013 & 0.02 & Changed PDF link colors \\
12-02-2014 & 0.03 & Updated block implementation \\
\hline
\end{tabular}
}
......
......@@ -9,7 +9,7 @@
\noindent \rule{\textwidth}{.1cm}
\hfill 18 Dec. 2013
\hfill February 12, 2014
\vspace*{3cm}
......
......@@ -59,6 +59,7 @@
changes in protocol \\
29-10-2013 & 0.04 & Changed PDF link colors \\
18-12-2013 & 1.00 & Finite version with watchdog timer and robust communication \\
12-02-2014 & 1.01 & Removed SIM_WB_TRANSFER state in FSM \\
\hline
\end{tabular}
}
......
......@@ -65,7 +65,7 @@
28-10-2013 & 0.1 & First draft \\
18-12-2013 & 1.0 & Added WDTO bit to status register and information about the FSM watchdog
mechanism \\
13-12-2013 & 1.1 & Made memory map prettier \\
13-02-2014 & 1.1 & Made memory map prettier \\
\hline
\end{tabular}
}
......
......@@ -10,6 +10,9 @@
-- version: 1.0
--
-- description:
-- Glitch filter consisting of a set of chained flip-flops followed by a
-- comparator. The comparator toggles to '1' when all FFs in the chain are
-- '1' and respectively to '0' when all the FFS in the chain are '0'.
--
-- dependencies:
--
......@@ -54,7 +57,7 @@ entity gc_glitch_filt is
clk_i : in std_logic;
rst_n_i : in std_logic;
-- Data input
-- Data input, synchronous to clk_i
dat_i : in std_logic;
-- Data output
......@@ -70,7 +73,6 @@ architecture behav of gc_glitch_filt is
-- Signal declarations
--============================================================================
signal glitch_filt : std_logic_vector(g_len downto 0);
signal dat_synced : std_logic;
--==============================================================================
-- architecture begin
......@@ -80,20 +82,7 @@ begin
--============================================================================
-- Glitch filtration logic
--============================================================================
-- First, synchronize the data input in the clk_i domain
cmp_sync : gc_sync_ffs
port map
(
clk_i => clk_i,
rst_n_i => rst_n_i,
data_i => dat_i,
synced_o => dat_synced,
npulse_o => open,
ppulse_o => open
);
-- Then, assign the current sample of the glitch filter
glitch_filt(0) <= dat_synced;
glitch_filt(0) <= dat_i;
-- Generate glitch filter FFs when the filter length is > 0
gen_glitch_filt: if (g_len > 0) generate
......
......@@ -138,8 +138,10 @@ architecture behav of gc_i2c_slave is
-- Signal declarations
--============================================================================
-- Deglitched signals and delays for SCL and SDA lines
signal scl_synced : std_logic;
signal scl_deglitched : std_logic;
signal scl_deglitched_d0 : std_logic;
signal sda_synced : std_logic;
signal sda_deglitched : std_logic;
signal sda_deglitched_d0 : std_logic;
signal scl_r_edge_p : std_logic;
......@@ -185,7 +187,21 @@ begin
--============================================================================
-- Deglitching logic
--============================================================================
-- Generate deglitched SCL signal with 54-ns max. glitch width
-- First, synchronize the SCL signal in the clk_i domain
cmp_sync_scl : gc_sync_ffs
generic map
(
g_sync_edge => "positive"
)
port map
(
clk_i => clk_i,
rst_n_i => rst_n_i,
data_i => scl_i,
synced_o => scl_synced
);
-- Generate deglitched SCL signal
cmp_scl_deglitch : gc_glitch_filt
generic map
(
......@@ -195,7 +211,7 @@ begin
(
clk_i => clk_i,
rst_n_i => rst_n_i,
dat_i => scl_i,
dat_i => scl_synced,
dat_o => scl_deglitched
);
......@@ -216,7 +232,21 @@ begin
end if;
end process p_scl_degl_d0;
-- Generate deglitched SDA signal with 54-ns max. glitch width
-- Synchronize SDA signal in clk_i domain
cmp_sda_sync : gc_sync_ffs
generic map
(
g_sync_edge => "positive"
)
port map
(
clk_i => clk_i,
rst_n_i => rst_n_i,
data_i => sda_i,
synced_o => sda_synced
);
-- Generate deglitched SDA signal
cmp_sda_deglitch : gc_glitch_filt
generic map
(
......@@ -226,7 +256,7 @@ begin
(
clk_i => clk_i,
rst_n_i => rst_n_i,
dat_i => sda_i,
dat_i => sda_synced,
dat_o => sda_deglitched
);
......
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