This commit is contained in:
Jörg Thalheim 2014-01-13 09:08:21 +01:00
parent e664c5e777
commit c72c930bc0
12 changed files with 397 additions and 239 deletions

83
.gitignore vendored Normal file
View File

@ -0,0 +1,83 @@
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
## Intermediate documents:
*.dvi
# these rules might exclude image files for figures etc.
*.ps
*.eps
*.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex.gz
*.pdfsync
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# amsthm
*.thm
# beamer
*.nav
*.snm
*.vrb
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
# hyperref
*.brf
# listings
*.lol
# makeidx
*.idx
*.ilg
*.ind
*.ist
# minitoc
*.maf
*.mtc
*.mtc0
# minted
*.pyg
# nomencl
*.nlo
# todonotes
*.tdo
# xindy
*.xdy
# verilog
*.vcd
/examples

View File

@ -2,18 +2,15 @@ C99?=c99
all: bericht check fsm_tb all: bericht check fsm_tb
bericht:
cd bericht && make
check: sqrt check: sqrt
./sqrt ./sqrt
sqrt: c/sqrt.c sqrt: c/sqrt.c
$(C99) -lm -o sqrt c/sqrt.c $(C99) -lm -o sqrt c/sqrt.c
bericht/graph.pdf: bericht/graph.dot
cd bericht; dot -Tpdf graph.dot > graph.pdf
bericht: bericht/graph.pdf
latexmk -pdf bericht/bericht.tex;
fsm: verilog/heron_fsm.vcd fsm: verilog/heron_fsm.vcd
gtkwave verilog/heron_fsm.vcd gtkwave verilog/heron_fsm.vcd
@ -28,3 +25,6 @@ ctrl_tb: verilog/heron_ctrl.vcd
%.vvp: %_tb.v %.v %.vvp: %_tb.v %.v
iverilog -o $@ -Iverilog verilog/heron_{fsm,ctrl}.v iverilog -o $@ -Iverilog verilog/heron_{fsm,ctrl}.v
sync:
rsync -av --inplace --rsync-path=~/rsync-3.1.0/rsync -avHz -e ssh verilog/ eeets2:verilog

38
SQRT.v
View File

@ -1,38 +0,0 @@
module SQRT(A, Y, clk, reset);
parameter width = 31;
`define width 31
input [width:0] A;
reg [width:0] x;
reg [width:0] old_x;
output [width:0] Y;
always @(A)
begin
case(state)
WAIT: Y = 0;
CALC1:
x = CALC1
state = OUTPUT
CALC2:
if (old_x <= x) begin
state = OUTPUT
end
OUTPUT: Y = Y_t;
default: Y = 0;
endcase
end
initial begin : parameter_check
if (width < 1) begin
$display("ERROR: %m :\n Invalid value (%d) for parameter width (lower bound: 1)", width);
$finish;
end
if (width > 32) begin
$display("ERROR: %m :\n Invalid value (%d) for parameter width (upper bound: 32)", width);
$finish;
end
end
endmodule

11
bericht/Makefile Normal file
View File

@ -0,0 +1,11 @@
all: bericht
%.pdf: %.tex
latexmk -pdf $<
%.pdf: %.dot
dot -Tpdf $< > $@
bericht.pdf: graph.pdf
bericht: bericht.pdf

View File

@ -24,7 +24,7 @@
listoftables, % includes list of tables listoftables, % includes list of tables
listoflistings, % includes list of listings listoflistings, % includes list of listings
abbrevations, % includes index of symbols and abbrevations abbrevations, % includes index of symbols and abbrevations
bibIfa, % citation style (IfA standard), alternatives: bibNumeric, bibHarvard bibNumeric, % citation style (IfA standard), alternatives: bibNumeric, bibHarvard
langDE % define the language (default: langDE) langDE % define the language (default: langDE)
]{ifathesis} ]{ifathesis}
\ifaThesis{Belegarbeit} \ifaThesis{Belegarbeit}
@ -36,6 +36,7 @@
\ifaKeywords{Praktikum, Schaltungsentwurf, Verilog} % Keywords included in pdf-file. Could be found e.g. by Windows file search. \ifaKeywords{Praktikum, Schaltungsentwurf, Verilog} % Keywords included in pdf-file. Could be found e.g. by Windows file search.
\ifaTitleDE{Schaltkreis- und Systementwurf} \ifaTitleDE{Schaltkreis- und Systementwurf}
\ifaTitleEN{} \ifaTitleEN{}
\bibliography{bibliography}
\ifaSupervisorA{Jens-Uwe Schlüßler} \ifaSupervisorA{Jens-Uwe Schlüßler}
\ifaProfessor{Prof. Dr.-Ing. habil. René Schüffny} \ifaProfessor{Prof. Dr.-Ing. habil. René Schüffny}
@ -46,99 +47,103 @@
\ifaAbstractEN{example_files/00_abstract_en__invalid} \ifaAbstractEN{example_files/00_abstract_en__invalid}
\usepackage{tabularx} \usepackage{tabularx}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{color}
\definecolor{mygreen}{rgb}{0,0.6,0} % Keine Kapitelnummerierung
\definecolor{mygray}{rgb}{0.5,0.5,0.5} \makeatletter
\definecolor{mymauve}{rgb}{0.58,0,0.82} \renewcommand{\thesection}{
\ifnum\c@chapter<1 \@arabic\c@section
\lstset{ % \else \thechapter.\@arabic\c@section
backgroundcolor=\color{white}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor} \fi
basicstyle=\footnotesize, % the size of the fonts that are used for the code
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
breaklines=true, % sets automatic line breaking
captionpos=b, % sets the caption-position to bottom
commentstyle=\color{mygreen}, % comment style
deletekeywords={...}, % if you want to delete keywords from the given language
escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
frame=single, % adds a frame around the code
keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
keywordstyle=\color{blue}, % keyword style
language=C, % the language of the code
morekeywords={*,...}, % if you want to add more keywords to the set
numbers=left, % where to put the line-numbers; possible values are (none, left, right)
numbersep=5pt, % how far the line-numbers are from the code
numberstyle=\tiny\color{mygray}, % the style that is used for the line-numbers
rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
showtabs=false, % show tabs within strings adding particular underscores
stepnumber=2, % the step between two line-numbers. If it's 1, each line will be numbered
stringstyle=\color{mymauve}, % string literal style
tabsize=2, % sets default tabsize to 2 spaces
title=\lstname % show the filename of files included with \lstinputlisting; also try caption instead of title
} }
\makeatother
\begin{document} \begin{document}
\chapter{Einleitung} \section{Einleitung}
TODO Kapitel 5.1 -> Aufgabenstellung Aufgabe des Praktikums \emph{Schaltkreis- und Systementwurf} ist es einen integrierten Schaltkreis (ASIC) für
einen numerischen Algorithmus zu entwickeln. Der Schaltkreis ist mit der
Enwicklungsumgebung \emph{Cadence} zu erstellen. Dabei ist den Arbeitsschritten der Aufgabenstellung
\cite{aufgabenstellung} zu folgen. Die Schaltung ist durch Simulation zu verifizieren.
Der folgende Bericht enthält die geforderte Dokumentation nach Kapitel 5.1
\cite{dokumentation} der Aufgabenstellung.
\chapter{Beschreibung des Algorithmus} \section{Beschreibung des Algorithmus}
Der hier selbst gewählte Algorithmus ist Ziehen der Quadratwurzel mithilfe des
Heronsche Näherungsverfahren (auch Babylonverfahren genannt). Es ist benannt
nach dem Altgriechen Heron von Alexandria, der es zum 1. Mal beschrieb. Es ist
vermutlich das älteste Nährungsverfahren für die Quadratwurzel. Wegen seines
einfachen Aufbaus, war es ein beliebter Algorithmus für die Implementierung in
Software bevor Hardwareimplementierung sich verbreitet haben.
Die Iterationsvorschrift des Verfahren lautet:
\begin{align} \begin{align}
x_{n+1}=\frac{x_n + \frac{a}{x_n}}{2} x_{n+1} & =\frac{x_n + \frac{a}{x_n}}{2} \\
lim_{n \rightarrow \infty} x_n & = \sqrt{a}
\end{align} \end{align}
\section{Implementierung in C} wobei $a$ der Ausgangswert ist, aus welchem die Wurzel berechnet werden soll und
\begin{lstlisting} $x_n$ der sich von Iterations zu Iterations an die Quadratwurzel annähernde
typedef uint32_t u32; Wert.
void heron_sqrt(u32 *mem) {
int i = mem[0];
while (i > 0) {
u32 s = mem[i];
if (s > 1) {
// x_0 = (s + 1) / 2
// without increment to avoid overflow for 0xffffffff
u32 x = s >> 1;
u32 old_x = x;
while(1) { Herleiten lässt sich die Folge aus dem Newton-Verfahren zur Bestimmung der
// x_{n + 1} = (x_n + (s / x_n)) / 2 Nullstellen ($x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$):
x = (x >> 1) + ((s/x) >> 1);
if (old_x <= x) { \begin{align}
break; x^2 &= a \\
} f(x) &= x^2 - a \\
old_x = x; f'(x) &= 2x \\
} x_{n + 1} &= x_n - \frac{f(x_n)}{f'(x_n)} \\
mem[i] = x; &= x_n - \frac{x_n^2 - a}{2x_n} \\
} &= x_n - \frac{x_n - a/x_n}{2} \\
i--; &= \frac{x_n + a/x_n}{2}
} \end{align}
}
\end{lstlisting} Wobei in diesem Praktikum die Quadratwurzel von mehreren hintereinander im
\subsection{Speicherbelegung} Speicher abgelegten Zahlen berechnet wird.
\section{Implementierung in C}
Der Prototyp des Algorithmus erfolgte in der Programmiersprache C nach dem
C99-Standard.
\ifalisting{Implementierung in C}{lst:implementierung}{c}{code/sqrt.c}{true}
Wie auch in der zu realisierenden Schaltung erwartet die Funktion im
Speicherfeld die Operanden für die Quadratwurzel-Berechnung. Wobei das 1. Feld
die Anzahl der Operanden angibt (siehe Speicherbelegung \ref{tbl:speicherbelegung}).
\subsection{Speicherbelegung und Zahlenformat}
Es wird angenommen, das jeder Speicherplatz 32 Bit breit ist. Es wird angenommen, das jeder Speicherplatz 32 Bit breit ist.
Jedes Datenfeld wird als vorzeichenlose Festkommazahl interpretiert. Jedes Datenfeld wird als vorzeichenlose Festkommazahl interpretiert.
Die Anzahl der Nachkommastellen lässt sich sowohl in der Schaltung
(heron\_comma\_fix) als auch in
der C-Implementierung (siehe Zeile \ref{comma}) leicht anpassen, wobei
vorrausgesetzt wird, dass die Anzahl durch 2 teilbar sein muss. Für die
Verifikation wurden 8. Kommastellen festgesetzt.
\begin{table}
\begin{tabularx}{\textwidth}{X|X} \begin{tabularx}{\textwidth}{X|X}
Speicherplatz & Beschreibung \\\hline Speicherplatz & Beschreibung \\\hline
MEM[0] & Anzahl der Operanden (n) \\ MEM[0] & Anzahl der Operanden (N) \\
MEM[1] & 1. Operand \\ MEM[1] & 1. Operand \\
MEM[2] & 2. Operand \\ MEM[2] & 2. Operand \\
$\ldots$ & $\dots$ \\ $\ldots$ & $\dots$ \\
MEM[N] & N. Operand MEM[N] & N. Operand
\end{tabularx} \end{tabularx}
\caption{Speicherbelegung}
\label{tbl:speicherbelegung}
\end{table}
\subsection{Datenflussgraph} \subsection{Datenflussgraph}
\begin{figure}[ht] \begin{figure}[ht]
\centering \centering
\includegraphics[width=0.3\textwidth]{graph.pdf} \includegraphics[width=0.6\textwidth]{graph.pdf}
\label{fig1} \label{fig1}
\end{figure} \end{figure}
\subsection{Datenpfad} \subsection{Datenpfad}
\end{document} \end{document}
% vim:spelllang=de

View File

@ -1,11 +1,21 @@
%% This BibTeX bibliography file was created using BibDesk.
%% http://bibdesk.sourceforge.net/
%% Saved with string encoding Unicode (UTF-8) %% Saved with string encoding Unicode (UTF-8)
#@misc{mda, @inbook {aufgabenstellung,
# Date-Added = {2010-01-09 12:34:49 +0100}, Date-Added = {2013-01-11 13:00:00 +0100},
# Date-Modified = {2010-01-09 12:35:30 +0100}, crossref = {einführung},
# Title = {{Model Driven Architecture}}, pages = "8"
# Url = {http://omg.org/mda}} }
@inbook {dokumentation,
Date-Added = {2013-01-11 13:00:00 +0100},
crossref = {einführung},
pages = "9"
}
@book{einführung,
Date-Added = {2013-01-11 13:00:00 +0100},
author = "Jens-Uwe Schlüßler",
title = "Einführung in die Anwendung des Entwurfssystems CADENCE für die
Lehrveranstaltung Schaltkreis- und Systementwurf",
year = "2013",
}

30
bericht/code/sqrt.c Normal file
View File

@ -0,0 +1,30 @@
typedef uint32_t u32;
// have to a multiply of 2
#define COMMA 8 @\label{comma}@
#define COMMA_FIX (COMMA >> 1)
void heron_sqrt(u32 *mem) {
int i = mem[0];
while (i > 0) {
u32 s = mem[i];
u32 x = s;
if (s > 1) {
// x_0 = (s + 1) / 2
// without increment to avoid overflow for 0xffffffff
x = x >> 1;
u32 old_x = x;
while(1) {
// x_{n + 1} = (x_n + (s / x_n)) / 2
x = (x >> 1) + ((s/x) >> 1);
if (old_x <= x) {
break;
}
old_x = x;
}
}
mem[i] = x << COMMA_FIX;
i--;
}
}

View File

@ -1,15 +1,15 @@
%!TEX root = example.tex %!TEX root = example.tex
%******************************************************************************* %*******************************************************************************
% * Copyright (c) 2006-2013 % * Copyright (c) 2006-2013
% * Institute of Automation, Dresden University of Technology % * Institute of Automation, Dresden University of Technology
% * % *
% * All rights reserved. This program and the accompanying materials % * All rights reserved. This program and the accompanying materials
% * are made available under the terms of the Eclipse Public License v1.0 % * are made available under the terms of the Eclipse Public License v1.0
% * which accompanies this distribution, and is available at % * which accompanies this distribution, and is available at
% * http://www.eclipse.org/legal/epl-v10.html % * http://www.eclipse.org/legal/epl-v10.html
% * % *
% * Contributors: % * Contributors:
% * Institute of Automation - TU Dresden, Germany % * Institute of Automation - TU Dresden, Germany
% * - initial API and implementation % * - initial API and implementation
% ******************************************************************************/ % ******************************************************************************/
@ -61,7 +61,7 @@
\PassOptionsToPackage{style=\@ifaBibliographyStyle, backend=bibtex8, maxbibnames=99}{biblatex} \PassOptionsToPackage{style=\@ifaBibliographyStyle, backend=bibtex8, maxbibnames=99}{biblatex}
\PassOptionsToPackage{svgnames}{xcolor} % Namensraum für xcolor Paket \PassOptionsToPackage{svgnames}{xcolor} % Namensraum für xcolor Paket
\PassOptionsToPackage{fleqn}{amsmath} \PassOptionsToPackage{fleqn}{amsmath}
\LoadClass[ \LoadClass[
@ -144,7 +144,7 @@
% Absatznummerierung fuer 4 Ebenen (z.B. 2.3.2.1) gemaess IfA Richtlinie einschalten. % Absatznummerierung fuer 4 Ebenen (z.B. 2.3.2.1) gemaess IfA Richtlinie einschalten.
\setcounter{secnumdepth}{3} \setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3} \setcounter{tocdepth}{3}
% Lade benötigte Pakete % Lade benötigte Pakete
\RequirePackage{scrhack} %Zur Herstellung der Kompabilitaet mit Paketen, die nicht kompatibel zum KOMA-Script sind. \RequirePackage{scrhack} %Zur Herstellung der Kompabilitaet mit Paketen, die nicht kompatibel zum KOMA-Script sind.
@ -153,10 +153,10 @@
% definiere Farben % definiere Farben
\definecolor{TUDBLAU}{rgb}{0.0,0.348,0.637} \definecolor{TUDBLAU}{rgb}{0.0,0.348,0.637}
\definecolor{OSGREEN}{rgb}{0,0.75,0.25} \definecolor{OSGREEN}{rgb}{0,0.75,0.25}
% Kläre zunächst einige Dinge, die von der Sprache abhängen % Kläre zunächst einige Dinge, die von der Sprache abhängen
\ifthenelse{\equal{\@ifaThesisLanguage}{de}}{ \ifthenelse{\equal{\@ifaThesisLanguage}{de}}{
% Deutsche Pakete % Deutsche Pakete
\RequirePackage[ngerman]{babel} % Silbentrennung nach neuer deutscher Rechtschreibung. \RequirePackage[ngerman]{babel} % Silbentrennung nach neuer deutscher Rechtschreibung.
\RequirePackage[german]{nomencl} \RequirePackage[german]{nomencl}
@ -166,7 +166,7 @@
\newcommand{\@appTitle}{Anhang} \newcommand{\@appTitle}{Anhang}
\renewcommand{\@pdftitle}{\@ifaTitleDE} \renewcommand{\@pdftitle}{\@ifaTitleDE}
\renewcommand{\nomname}{Abkürzungs- und Symbolverzeichnis} \renewcommand{\nomname}{Abkürzungs- und Symbolverzeichnis}
\renewcommand{\lstlistlistingname}{Quelltextverzeichnis} \renewcommand{\lstlistlistingname}{Quelltextverzeichnis}
}{ }{
% Englische Pakete % Englische Pakete
\RequirePackage[english]{babel} % Silbentrennung nach englischer Rechtschreibung. \RequirePackage[english]{babel} % Silbentrennung nach englischer Rechtschreibung.
@ -177,7 +177,7 @@
\newcommand{\@appTitle}{Appendix} \newcommand{\@appTitle}{Appendix}
\renewcommand{\@pdftitle}{\@ifaTitleEN} \renewcommand{\@pdftitle}{\@ifaTitleEN}
\renewcommand{\nomname}{Nomenclature} \renewcommand{\nomname}{Nomenclature}
\renewcommand{\lstlistlistingname}{List of Listings} \renewcommand{\lstlistlistingname}{List of Listings}
} }
%------------------------------------------------------------------------- %-------------------------------------------------------------------------
@ -190,7 +190,7 @@
\appendixname~\thechapter\autodot:\enskip} \appendixname~\thechapter\autodot:\enskip}
} }
%------------------------------------------------------------------------- %-------------------------------------------------------------------------
% Veränderung der Bildunterschriften und Tabellenüberschriften: % Veränderung der Bildunterschriften und Tabellenüberschriften:
\addtokomafont{caption}{\small} % Kleinere Schriftgröße für Captions \addtokomafont{caption}{\small} % Kleinere Schriftgröße für Captions
\setkomafont{captionlabel}{\sffamily\bfseries} % Caption-Label fett und serifenlos \setkomafont{captionlabel}{\sffamily\bfseries} % Caption-Label fett und serifenlos
@ -199,8 +199,8 @@
% Anpassung des Literaturverzeichnisses % Anpassung des Literaturverzeichnisses
\setlength{\bibitemsep}{10pt} \setlength{\bibitemsep}{10pt}
\defbibheading{bibliography}{ \defbibheading{bibliography}{
\chapter*{\@bibTitle} \chapter*{\@bibTitle}
\addcontentsline{toc}{chapter}{\@bibTitle} \addcontentsline{toc}{chapter}{\@bibTitle}
} }
% Notwendig für Autovervollständigung der Zitate im Texnic Center % Notwendig für Autovervollständigung der Zitate im Texnic Center
\renewcommand*{\bibliography}[1]{\addbibresource{#1.bib}} \renewcommand*{\bibliography}[1]{\addbibresource{#1.bib}}
@ -211,84 +211,107 @@
% Löst Probleme mit deutschen Umlauten in Listings % Löst Probleme mit deutschen Umlauten in Listings
%------------------------------------------------------------------------- %-------------------------------------------------------------------------
\lstset{literate=% \lstset{literate=%
{Ö}{{\"O}}1 {Ö}{{\"O}}1
{Ä}{{\"A}}1 {Ä}{{\"A}}1
{Ü}{{\"U}}1 {Ü}{{\"U}}1
{ß}{{\ss}}2 {ß}{{\ss}}2
{ü}{{\"u}}1 {ü}{{\"u}}1
{ä}{{\"a}}1 {ä}{{\"a}}1
{ö}{{\"o}}1 {ö}{{\"o}}1
} }
%------------------------------------------------------------------------- %-------------------------------------------------------------------------
% Integriert Listings und baut diese als Gleitobjekt aus, wenn gewünscht % Integriert Listings und baut diese als Gleitobjekt aus, wenn gewünscht
%------------------------------------------------------------------------- %-------------------------------------------------------------------------
% Usage: \listing{<Caption>}{<Label>}{<[Dialect]Language>}{<Pfad>}{<float?>} % Usage: \listing{<Caption>}{<Label>}{<[Dialect]Language>}{<Pfad>}{<float?>}
\newcommand*{\ifalisting}[6]{ \newcommand*{\ifalisting}[5]{
\renewcommand{\lstlistingname}{\hspace{-0.6cm}Listing} \renewcommand{\lstlistingname}{\hspace{-0.6cm}Listing}
\ifthenelse{\equal{#6}{true}}{ \ifthenelse{\equal{#5}{true}}{
\ifalistingFloat{#1}{#2}{#3}{#4}{#5} \ifalistingFloat{#1}{#2}{#3}{#4}
}{ }{
\ifalistingNoFloat{#1}{#2}{#3}{#4}{#5} \ifalistingNoFloat{#1}{#2}{#3}{#4}
} }
\vspace{4.5mm} \vspace{4.5mm}
} }
\newcommand*{\ifalistingFloat}[5]{% \newcommand*{\ifalistingFloat}[4]{%
\begin{minipage}{0.96\textwidth} \begin{minipage}{0.96\textwidth}
\lstset{belowcaptionskip=2mm} % Abstand unterhalb der Beschriftung \lstset{belowcaptionskip=2mm} % Abstand unterhalb der Beschriftung
\ifalistingRaw{#1}{#2}{#3}{#4}{#5} \ifalistingRaw{#1}{#2}{#3}{#4}
\end{minipage} \end{minipage}
} }
% Thanks to Matthias Freund who provided the code to enables listings which are longer than one page.
%
\newcommand*{\ifalistingNoFloat}[5]{%
\begin{addmargin}[4mm]{1.5mm} % verändert den Abstand ohne Verwendung einer Minipage
\lstset{belowcaptionskip=2mm} % Abstand unterhalb der Beschriftung
\ifalistingRaw{#1}{#2}{#3}{#4}{#5}
\vspace{-1mm}
\begin{flushright}
\scriptsize
Listing \ref{#2}
\end{flushright}
\end{addmargin}
}
\newcommand*{\ifalistingRaw}[5]{ % Thanks to Matthias Freund who provided the code to enables listings which are longer than one page.
\lstinputlisting[ %
caption={#1}, \newcommand*{\ifalistingNoFloat}[4]{%
label={#2}, \begin{addmargin}[4mm]{1.5mm} % verändert den Abstand ohne Verwendung einer Minipage
language={#3}, \lstset{belowcaptionskip=2mm} % Abstand unterhalb der Beschriftung
keywordstyle=\bfseries\color{blue}, \ifalistingRaw{#1}{#2}{#3}{#4}
identifierstyle=\bf, \vspace{-1mm}
stringstyle=\itshape\color{red}, \begin{flushright}
basicstyle=\ttfamily\color{black}\footnotesize, % Schriftschnitt des Codes \scriptsize
showstringspaces=false, % Leerzeichen nicht markieren Listing \ref{#2}
commentstyle=\color{green}, % Schriftschnitt der Kommentare \end{flushright}
tabsize=2, % Tabulatorengröße in Leerzeichen \end{addmargin}
breaklines=true, % zu lange Zeilen umbrechen }
frame=tb, % Rahmen um das Listing
abovecaptionskip=3mm, % Abstand oberhalb der Beschriftung \usepackage{color}
captionpos=t, % Position der Beschriftung (b=bottom, t=top)
numbers=#4, \definecolor{mygreen}{rgb}{0,0.6,0}
numbersep=5pt \definecolor{mygray}{rgb}{0.5,0.5,0.5}
]{#5} \definecolor{mymauve}{rgb}{0.58,0,0.82}
\newcommand*{\ifalistingRaw}[4]{
\lstinputlisting[
caption={#1},
label={#2},
language={#3},
showstringspaces=false, % Leerzeichen nicht markieren
tabsize=2, % Tabulatorengröße in Leerzeichen
breaklines=true, % zu lange Zeilen umbrechen
frame=tb, % Rahmen um das Listing
abovecaptionskip=3mm, % Abstand oberhalb der Beschriftung
captionpos=t, % Position der Beschriftung (b=bottom, t=top)
numbers=left,
numbersep=5pt,
commentstyle=\color{mygreen}, % comment style
deletekeywords={...}, % if you want to delete keywords from the given language
escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
escapechar=@,
extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
frame=single, % adds a frame around the code
keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
keywordstyle=\color{blue}, % keyword style
backgroundcolor=\color{white}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}
basicstyle=\footnotesize, % the size of the fonts that are used for the code
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
breaklines=true, % sets automatic line breaking
captionpos=b, % sets the caption-position to bottom
morekeywords={*,...}, % if you want to add more keywords to the set
numberstyle=\tiny\color{mygray}, % the style that is used for the line-numbers
rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
showtabs=false, % show tabs within strings adding particular underscores
stepnumber=2, % the step between two line-numbers. If it's 1, each line will be numbered
stringstyle=\color{mymauve}, % string literal style
tabsize=2, % sets default tabsize to 2 spaces
]{#4}
} }
% Erlaubt das Einfügen eines automatischen Symbolverzeichnisses % Erlaubt das Einfügen eines automatischen Symbolverzeichnisses
% Definiere die richtige Sprache (bspw. für Silbentrennung, ...) % Definiere die richtige Sprache (bspw. für Silbentrennung, ...)
% [Die entsprechenden Pakete wurden bereits eingefügt] % [Die entsprechenden Pakete wurden bereits eingefügt]
\makenomenclature \makenomenclature
% Jetzt geht es los... % Jetzt geht es los...
\AtBeginDocument{% \AtBeginDocument{%
% colorlinks: Farbige Verweise statt Umrahmung % colorlinks: Farbige Verweise statt Umrahmung
% Verhalten von hyperef Ändern: Farbe für Bildschirm, SW für Druck % Verhalten von hyperef Ändern: Farbe für Bildschirm, SW für Druck
% ...color: Farbe verschiedener Verweise nach Farbpalette svgnames % ...color: Farbe verschiedener Verweise nach Farbpalette svgnames
% pdf...: Setzten von Variablen die in den Eigenschaften der PDF-Datei angzeigt werden % pdf...: Setzten von Variablen die in den Eigenschaften der PDF-Datei angzeigt werden
% Weitere Optionen möglich - siehe Dokumentation des Paktes hyperref % Weitere Optionen möglich - siehe Dokumentation des Paktes hyperref
\hypersetup{ \hypersetup{
linkcolor=\if@isReadyForPrint black\else TUDBLAU\fi,% linkcolor=\if@isReadyForPrint black\else TUDBLAU\fi,%
urlcolor=\if@isReadyForPrint black\else TUDBLAU\fi,% urlcolor=\if@isReadyForPrint black\else TUDBLAU\fi,%
@ -303,12 +326,12 @@
% ================= % =================
% = Titelseite(n) = % = Titelseite(n) =
% ================= % =================
\begin{titlepage} \begin{titlepage}
\begin{picture}(0,0) \begin{picture}(0,0)
\put(-97,-50){\includegraphics*{kopfzeile}} \put(-97,-50){\includegraphics*{kopfzeile}}
\end{picture} \end{picture}
% A dissertation will get a different titlepage % A dissertation will get a different titlepage
\ifthenelse{\not\equal{\@ifaThesis}{Dissertation}}{ \ifthenelse{\not\equal{\@ifaThesis}{Dissertation}}{
% =============================== % ===============================
@ -324,7 +347,7 @@
\begin{tabular}{rl} \begin{tabular}{rl}
vorgelegt von & \@ifaAuthor \\ vorgelegt von & \@ifaAuthor \\
im Studiengang & \@ifaAuthorCourse,\:Jg.\:\@ifaAuthorYearOfMatriculation \\ im Studiengang & \@ifaAuthorCourse,\:Jg.\:\@ifaAuthorYearOfMatriculation \\
geboren am & \@ifaAuthorBirthday\:in\:\@ifaAuthorBirthplace\\ geboren am & \@ifaAuthorBirthday\:in\:\@ifaAuthorBirthplace\\
\end{tabular} \end{tabular}
\vfill \vfill
\ifthenelse{\equal{\@ifaThesis}{Diplomarbeit}}{ \ifthenelse{\equal{\@ifaThesis}{Diplomarbeit}}{
@ -380,13 +403,13 @@
% Aufgabenstellung % Aufgabenstellung
\IfFileExists{\@ifaTopicDescriptionPDF} { \IfFileExists{\@ifaTopicDescriptionPDF} {
\includepdf{\@ifaTopicDescriptionPDF} \includepdf{\@ifaTopicDescriptionPDF}
\cleardoublepage \cleardoublepage
}{ }{
\ifthenelse{\not\equal{\@ifaThesis}{Dissertation}}{ \ifthenelse{\not\equal{\@ifaThesis}{Dissertation}}{
\ClassWarning{ifathesis}{Es wurde keine Aufgabenstellung angegeben.} \ClassWarning{ifathesis}{Es wurde keine Aufgabenstellung angegeben.}
}{} }{}
} }
% Kurzfassungen % Kurzfassungen
\IfFileExists{\@ifaAbstractDE}{ \IfFileExists{\@ifaAbstractDE}{
\begin{picture}(0,0) \begin{picture}(0,0)
@ -418,8 +441,8 @@
\cleardoublepage \cleardoublepage
}{ }{
\ClassWarning{ifathesis}{ \ClassWarning{ifathesis}{
Konnte die englische Kurzfassung nicht finden. Diese ist fuer Arbeiten am Institut fuer Konnte die englische Kurzfassung nicht finden. Diese ist fuer Arbeiten am Institut fuer
Automatisierungstechnik unbedingt erforderlich. Sollte die Vorlage anderswo verwendet, Automatisierungstechnik unbedingt erforderlich. Sollte die Vorlage anderswo verwendet,
dann kann diese Warnung ignoriert werden. dann kann diese Warnung ignoriert werden.
} }
} }
@ -450,19 +473,19 @@
\cleardoublepage \cleardoublepage
}{ }{
\ClassWarning{ifathesis}{ \ClassWarning{ifathesis}{
Konnte die englische Kurzfassung nicht finden. Diese ist fuer Arbeiten am Institut fuer Konnte die englische Kurzfassung nicht finden. Diese ist fuer Arbeiten am Institut fuer
Automatisierungstechnik unbedingt erforderlich. Sollte die Vorlage anderswo verwendet, Automatisierungstechnik unbedingt erforderlich. Sollte die Vorlage anderswo verwendet,
dann kann diese Warnung ignoriert werden. dann kann diese Warnung ignoriert werden.
} }
} }
% Danksagung % Danksagung
\IfFileExists{\@ifaAcknowledgements}{ \IfFileExists{\@ifaAcknowledgements}{
\chapter*{\IfStrEq{\@ifaThesisLanguage}{de}{Danksagung}{Acknowledgements}} \chapter*{\IfStrEq{\@ifaThesisLanguage}{de}{Danksagung}{Acknowledgements}}
\input{\@ifaAcknowledgements} \input{\@ifaAcknowledgements}
\cleardoublepage \cleardoublepage
}{} }{}
% Verzeichnisse % Verzeichnisse
\pdfbookmark[1]{\@conTitle}{toc} \pdfbookmark[1]{\@conTitle}{toc}
\tableofcontents \tableofcontents
@ -486,7 +509,7 @@
}{} }{}
\fi \fi
\endgroup \endgroup
\mainmatter \mainmatter
\pagestyle{scrheadings} \pagestyle{scrheadings}
@ -496,15 +519,15 @@
\AtEndDocument{ \AtEndDocument{
\cleardoublepage \cleardoublepage
% Auch Abschnittsbeginn ohne Kopf- und Fußzeile % Auch Abschnittsbeginn ohne Kopf- und Fußzeile
%\renewcommand*{\chapterpagestyle}{empty} %\renewcommand*{\chapterpagestyle}{empty}
% Literaturverzeichnis vor dem Anhang % Literaturverzeichnis vor dem Anhang
\ifthenelse{\equal{\@ifaBibliographyBeforeAppendix}{true}}{ \ifthenelse{\equal{\@ifaBibliographyBeforeAppendix}{true}}{
\if@isReadyForPrint \if@isReadyForPrint
\markboth{\@bibTitle}{} \markboth{\@bibTitle}{}
\else \else
\markright{\@bibTitle} \markright{\@bibTitle}
\fi \fi
\printbibliography \printbibliography
\cleardoublepage \cleardoublepage
\automark[section]{chapter} \automark[section]{chapter}
}{} }{}
@ -512,33 +535,33 @@
% Anhänge % Anhänge
\IfFileExists{\@ifaAppendix}{ \IfFileExists{\@ifaAppendix}{
\renewcommand{\appendixpagename}{\@appTitle} \renewcommand{\appendixpagename}{\@appTitle}
% Zuerst die Titelseite % Zuerst die Titelseite
\begin{center} \begin{center}
\thispagestyle{empty} \thispagestyle{empty}
\vspace*{\fill} \vspace*{\fill}
{\sffamily\bf\huge\appendixpagename} {\sffamily\bf\huge\appendixpagename}
\vspace{\fill} \vspace{\fill}
\cleardoublepage \cleardoublepage
\end{center} \end{center}
% Nun die Anhänge, ohne Titelseite (siehe \RequirePackage --> ohne page-Option) % Nun die Anhänge, ohne Titelseite (siehe \RequirePackage --> ohne page-Option)
\begin{appendices} \begin{appendices}
\ifthenelse{\equal{\@ifaBibliographyBeforeAppendix}{true}}{ \ifthenelse{\equal{\@ifaBibliographyBeforeAppendix}{true}}{
\pagenumbering{Roman} % römische Nummerierung im Anhang \pagenumbering{Roman} % römische Nummerierung im Anhang
\setcounter{page}{1} % beginne wieder mit Seitenzahl 1 \setcounter{page}{1} % beginne wieder mit Seitenzahl 1
}{} }{}
\input{\@ifaAppendix} \input{\@ifaAppendix}
\cleardoublepage \cleardoublepage
\end{appendices} \end{appendices}
}{} }{}
% Literaturverzeichnis nach dem Anhang % Literaturverzeichnis nach dem Anhang
\ifthenelse{\equal{\@ifaBibliographyBeforeAppendix}{false}}{ \ifthenelse{\equal{\@ifaBibliographyBeforeAppendix}{false}}{
\if@isReadyForPrint \if@isReadyForPrint
\markboth{\@bibTitle}{} \markboth{\@bibTitle}{}
\else \else
\markright{\@bibTitle} \markright{\@bibTitle}
\fi \fi
\printbibliography \printbibliography
\cleardoublepage \cleardoublepage
\automark[section]{chapter} \automark[section]{chapter}
}{} }{}
@ -546,12 +569,12 @@
\backmatter \backmatter
% Im Abspann nur Seiten ohne Kopf- und Fußzeile (außer Abschnittsbeginn) % Im Abspann nur Seiten ohne Kopf- und Fußzeile (außer Abschnittsbeginn)
\pagestyle{empty} \pagestyle{empty}
% Auch Abschnittsbeginn ohne Kopf- und Fußzeile % Auch Abschnittsbeginn ohne Kopf- und Fußzeile
\renewcommand*{\chapterpagestyle}{empty} \renewcommand*{\chapterpagestyle}{empty}
% Selbständigkeitserklärung % Selbständigkeitserklärung
\vspace*{\fill} %4cm} \vspace*{\fill} %4cm}
\section*{Selbstständigkeitserklärung} \section*{Selbstständigkeitserklärung}
Hiermit versichere ich, \@ifaAuthor, geboren am \@ifaAuthorBirthday~in Hiermit versichere ich, \@ifaAuthor, geboren am \@ifaAuthorBirthday~in
\@ifaAuthorBirthplace, dass ich \ifthenelse{\not\equal{\@ifaThesis}{Forschungspraktikum}}{die vorliegende \@ifaThesis}{das vorliegende \@ifaThesis}~zum Thema \@ifaAuthorBirthplace, dass ich \ifthenelse{\not\equal{\@ifaThesis}{Forschungspraktikum}}{die vorliegende \@ifaThesis}{das vorliegende \@ifaThesis}~zum Thema
@ -560,18 +583,18 @@ Hiermit versichere ich, \@ifaAuthor, geboren am \@ifaAuthorBirthday~in
\emph{\@ifaTitleDE} \emph{\@ifaTitleDE}
\end{center} \end{center}
\end{quote} \end{quote}
ohne unzulässige Hilfe Dritter und ohne Benutzung anderer als der angegebenen Hilfsmittel angefertigt habe; ohne unzulässige Hilfe Dritter und ohne Benutzung anderer als der angegebenen Hilfsmittel angefertigt habe;
die aus fremden Quellen direkt oder indirekt übernommenen Gedanken sind als die aus fremden Quellen direkt oder indirekt übernommenen Gedanken sind als
solche kenntlich gemacht. Bei der Auswahl und Auswertung des Materials sowie solche kenntlich gemacht. Bei der Auswahl und Auswertung des Materials sowie
bei der Herstellung des Manuskripts habe ich Unterstützungsleistungen von folgenden Personen erhalten: bei der Herstellung des Manuskripts habe ich Unterstützungsleistungen von folgenden Personen erhalten:
\begin{center} \begin{center}
\emph{\@ifaSupervisorA\IfStrEq{\@ifaSupervisorB}{}{}{, \@ifaSupervisorB}\IfStrEq{\@ifaSupervisorC}{}{}{, \@ifaSupervisorC}\IfStrEq{\@ifaSupervisorD}{}{}{, \@ifaSupervisorD}\IfStrEq{\@ifaSupervisorE}{}{}{, \@ifaSupervisorE}\IfStrEq{\@ifaAdditionalContributors}{}{}{, \@ifaAdditionalContributors}} \emph{\@ifaSupervisorA\IfStrEq{\@ifaSupervisorB}{}{}{, \@ifaSupervisorB}\IfStrEq{\@ifaSupervisorC}{}{}{, \@ifaSupervisorC}\IfStrEq{\@ifaSupervisorD}{}{}{, \@ifaSupervisorD}\IfStrEq{\@ifaSupervisorE}{}{}{, \@ifaSupervisorE}\IfStrEq{\@ifaAdditionalContributors}{}{}{, \@ifaAdditionalContributors}}
\end{center} \end{center}
Weitere Personen waren an der geistigen Herstellung \ifthenelse{\not\equal{\@ifaThesis}{Forschungspraktikum}}{der vorliegenden \@ifaThesis}{des vorliegenden \@ifaThesis s}~nicht beteiligt. Mir ist bekannt, dass die Nichteinhaltung dieser Erklärung zum nachträglichen Entzug des Diplomabschlusses (Masterabschlusses) führen kann. Weitere Personen waren an der geistigen Herstellung \ifthenelse{\not\equal{\@ifaThesis}{Forschungspraktikum}}{der vorliegenden \@ifaThesis}{des vorliegenden \@ifaThesis s}~nicht beteiligt. Mir ist bekannt, dass die Nichteinhaltung dieser Erklärung zum nachträglichen Entzug des Diplomabschlusses (Masterabschlusses) führen kann.
\vspace{2cm} \vspace{2cm}
\begin{flushright} \begin{flushright}
Dresden, den \@ifaDayOfSubmission \hfill \dotfill\\ Dresden, den \@ifaDayOfSubmission \hfill \dotfill\\
Unterschrift Unterschrift
\end{flushright} \end{flushright}
\vfill \vfill
}%EOF }%EOF

View File

@ -31,7 +31,7 @@
\RequirePackage{pdfpages} % Zum einbinden von kompletten PDF-Seiten (z.B. Aufgabenstellung) \RequirePackage{pdfpages} % Zum einbinden von kompletten PDF-Seiten (z.B. Aufgabenstellung)
\RequirePackage{caption} % Paket zum Einbinden von Captions bei Nicht-Float-Objekten (hauptsächlich für Anhang) \RequirePackage{caption} % Paket zum Einbinden von Captions bei Nicht-Float-Objekten (hauptsächlich für Anhang)
\RequirePackage[ % Verwendung von biblatex für das Literaturverzeichnis \RequirePackage[ % Verwendung von biblatex für das Literaturverzeichnis
backref=true, backref=true,
natbib=true natbib=true
]{biblatex} ]{biblatex}
@ -100,4 +100,4 @@
\RequirePackage{icomma} \RequirePackage{icomma}
% date time % date time
\RequirePackage{datetime} \RequirePackage{datetime}

View File

@ -2,12 +2,11 @@
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
typedef uint32_t u32; typedef uint32_t u32;
// have to a multiply of 2 // have to a multiply of 2
#define COMMA 10 #define COMMA 8
#define COMMA_FIX (COMMA >> 1) #define COMMA_FIX (COMMA >> 1)
void heron_sqrt(u32 *mem) { void heron_sqrt(u32 *mem) {
@ -37,7 +36,7 @@ void heron_sqrt(u32 *mem) {
int main() { int main() {
float data[] = { float data[] = {
/0, 0,
//0.5, //0.5,
1.0 / (1 << COMMA), 1.0 / (1 << COMMA),
1.0 / (1 << (COMMA - 1)), 1.0 / (1 << (COMMA - 1)),

View File

@ -2,7 +2,7 @@
module heron_ctrl( module heron_ctrl(
// data path // data path
a_to_adr, a_to_eab,
a_to_i, a_to_i,
a_to_old_x, a_to_old_x,
a_to_s, a_to_s,
@ -36,7 +36,7 @@ module heron_ctrl(
parameter PLUS = 1'b0; parameter PLUS = 1'b0;
// data path // data path
output a_to_adr; output a_to_eab;
output a_to_i; output a_to_i;
output a_to_old_x; output a_to_old_x;
output a_to_s; output a_to_s;
@ -64,7 +64,7 @@ module heron_ctrl(
output ram_wr_en; output ram_wr_en;
// data path // data path
reg a_to_adr; reg a_to_eab;
reg a_to_i; reg a_to_i;
reg a_to_old_x; reg a_to_old_x;
reg a_to_s; reg a_to_s;
@ -92,7 +92,7 @@ module heron_ctrl(
reg ram_wr_en; reg ram_wr_en;
always @(state) begin always @(state) begin
a_to_adr = OFF; a_to_eab = OFF;
a_to_i = OFF; a_to_i = OFF;
a_to_old_x = OFF; a_to_old_x = OFF;
a_to_s = OFF; a_to_s = OFF;
@ -124,7 +124,7 @@ module heron_ctrl(
end end
`LD_N_1: begin `LD_N_1: begin
k0_to_a = ON; k0_to_a = ON;
a_to_adr = ON; a_to_eab = ON;
edb_to_din = ON; edb_to_din = ON;
ram_rd_en = ON; ram_rd_en = ON;
end end
@ -141,7 +141,7 @@ module heron_ctrl(
`LD_S_1: begin `LD_S_1: begin
i_to_a = ON; i_to_a = ON;
edb_to_din = ON; edb_to_din = ON;
a_to_adr = ON; a_to_eab = ON;
ram_rd_en = ON; ram_rd_en = ON;
end end
`LD_S_2: begin `LD_S_2: begin

View File

@ -1,4 +1,39 @@
module heron_top_tb ( ); module heron_top_tb ( );
task assert;
input condition;
input [(20*8 - 1):0] message;
begin
if (condition !== 1'b1)
begin
$display("Assertion Failed: %s", message);
$finish(2);
end
end
endtask
parameter CYCLE = 50;
wire [31:0] edb;
wire [31:0] eab;
wire ready;
wire ram_wr_en;
wire ram_rd_en;
reg clk, reset;
reg load;
reg [31:0] ram [0:1023];
heron_top heron(
.eab(eab),
.edb(edb),
.clk(clk),
.reset(reset),
.ram_wr_en(ram_wr_en),
.ram_rd_en(ram_rd_en),
.ready(ready),
.load(load)
);
endmodule endmodule