Skip to content

Commit 200f13b

Browse files
committed
Move tutorial documentation from chisel.
1 parent 002c042 commit 200f13b

File tree

10 files changed

+5470
-1
lines changed

10 files changed

+5470
-1
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include objdirroot.mk
55

66
# Directories removed by make clean
77
RM_DIRS := emulator project/target target $(objdirroot)
8+
CLEAN_DIRS := doc
89

910
# All subdirectories
1011
ALL_SUB_DIRS := examples hello problems solutions
@@ -51,7 +52,7 @@ endef
5152
# Generate the cross product of target_SUB_DIRS and SUB_DIR_TARGETS
5253
$(foreach t,$(SUB_DIR_TARGETS),$(eval $(call GenSubDirTargets,$t)))
5354

54-
.PHONY: $(ALL_SUB_DIRS) check clean compile jenkins-build smoke
55+
.PHONY: $(ALL_SUB_DIRS) check clean compile jenkins-build smoke doc
5556

5657
# Generate the generic "make default in sub-directory".
5758
$(ALL_SUB_DIRS):
@@ -68,6 +69,12 @@ jenkins-build: clean smoke check
6869
# clean: $(_cleaners)
6970
clean:
7071
if [ -n "$(RM_DIRS)" ] ; then $(RM) -r $(RM_DIRS); fi
72+
if [ -n "$(CLEAN_DIRS)" ] ; then \
73+
for dir in $(CLEAN_DIRS); do $(MAKE) -C $$dir clean; done; \
74+
fi
75+
76+
doc:
77+
(cd doc && $(MAKE) all)
7178

7279
# GenSubDirTargets generates dependencies:
7380
# smoke: $(_smokeers)

doc/Makefile

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Building the docs on osx will require to install Jinja2 and BeautifulSoup:
2+
# $ pip install Jinja2 BeautifulSoup
3+
# and the different tools for text to pdf:
4+
# $ port install texlive-latex-extra texlive-latex-recommended \
5+
# texlive-htmlxml ImageMagick
6+
#
7+
# For building on Ubuntu 14.04 LTS, the following packages should be
8+
# installed with "apt-get install":
9+
# python-bs4 imagemagick source-highlight tex4ht texlive-latex-base \
10+
# texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended \
11+
# texlive-fonts-extra
12+
13+
PDFLATEX := pdflatex
14+
WWW_PAGES :=
15+
WWW_EXTRA :=
16+
17+
# The following subdirectories build documentation correctly.
18+
PDF_DIRS := tutorial
19+
# Define a function to map PDF_DIRS to a PDF base name.
20+
# Basically, every directory is the base name of the pdf except for dac12-talk.
21+
pdf_base_name_from_dir = $(subst talks/dac12,dac12-talk,$(1))
22+
# Define a map function to apply a function to multiple arguments.
23+
map = $(foreach arg,$(2),$(call $(1),$(arg)))
24+
25+
PDFS := $(addsuffix .pdf,$(addprefix chisel-,$(call map,pdf_base_name_from_dir,$(PDF_DIRS))))
26+
27+
# Suffixes for tex temporary files we'll clean
28+
TEX_SUFFIXES := 4ct 4tc aux css dvi html idv lg log out tmp xref
29+
TEX_TEMP_FILES := $(foreach dir,$(PDF_DIRS),$(foreach suffix,$(TEX_SUFFIXES),$(dir)/$(call pdf_base_name_from_dir,$(dir)).$(suffix)))
30+
STY_TEMP_FILES := $(foreach dir,$(PDF_DIRS),$(dir)/$(call pdf_base_name_from_dir,$(dir))_date.sty)
31+
32+
LATEX2MAN := latex2man
33+
MAN_PAGES := chisel.man
34+
35+
srcDir := .
36+
installTop:= ../www
37+
38+
vpath %.tex $(addprefix $(srcDir)/,$(PDF_DIRS))
39+
40+
vpath %.mtt $(addprefix $(srcDir)/,$(PDF_DIRS))
41+
42+
all: $(WWW_PAGES) $(WWW_EXTRA) $(PDFS)
43+
44+
extra: $(WWW_EXTRA)
45+
46+
html: $(WWW_PAGES)
47+
48+
pdf: $(PDFS)
49+
50+
install: all
51+
52+
# NOTE: We follow the recommended practice of running the *latex tools twice
53+
# so references (citations and figures) are correctly handled.
54+
# NOTE: There are problems with running pdflatex after htlatex due to the
55+
# manual.aux file left over by the latter. We see:
56+
# ./manual.tex:113: Undefined control sequence.
57+
# <argument> ...tring :autoref\endcsname {\@captype
58+
# }1
59+
# l.113 Figure~\ref{fig:node-hierarchy}
60+
# This was reported at:
61+
# http://tex.stackexchange.com/questions/117802/running-pdflatex-after-htlatex-causes-hyperref-error-undefined-control-sequence
62+
# but apparently went away after upgrading to texlive 2013.
63+
# It fails on ubuntu 14.04 LTS and texlive-latex-recommended 2013.20140215-1
64+
# if we don't remove the manual.aux file
65+
chisel-%.pdf: %.tex %_date.sty
66+
rm -f $(subst .tex,.aux,$<)
67+
cd $(dir $<) && for c in 0 1; do pdflatex -file-line-error -interaction nonstopmode -output-directory $(PWD) $(notdir $<) ; done
68+
mv $(subst .tex,.pdf,$(notdir $<)) $@
69+
70+
%.html: %.tex %_date.sty
71+
cd $(dir $<) && for c in 0 1; do htlatex $(notdir $<) $(PWD)/$(srcDir)/html.cfg "" -d/$(PWD)/ ; done
72+
mv $(subst .tex,.html,$(notdir $<)) $@~
73+
$(srcDir)/../bin/tex2html.py $@~ $@
74+
75+
%.man: %.mtt
76+
# cd into the directory containing the .tex file and massage it
77+
cd $(dir $<) && \
78+
sed -e "s/@VERSION@/$(RELEASE_TAG)/" -e "s/@DATE@/$(RELEASE_DATE)/" $(notdir $<) > $(basename $@).ttex ;\
79+
latex2man $(basename $@).ttex $@
80+
81+
%.html: $(srcDir)/templates/%.html $(srcDir)/templates/base.html
82+
$(srcDir)/../bin/jinja2html.py $(notdir $<) $@
83+
84+
clean:
85+
-rm -f $(TEX_TEMP_FILES)
86+
-rm -f $(STY_TEMP_FILES)
87+
# Remove any .{png,graffle} files that are created from pdfs
88+
-rm -f $(foreach gext,png graffle,$(subst .pdf,.$(gext),$(wildcard tutorial/figs/*.pdf)))
89+
-rm -f $(WWW_PAGES) $(PDFS) $(WWW_EXTRA) $(addsuffix .1,$(WWW_EXTRA)) $(patsubst %.html,%.css,$(WWW_EXTRA))
90+
-rm -f *~ *.aux *.log *.nav *.out *.snm *.toc *.vrb
91+
-rm -f *.jpg *.png
92+
93+
# Generate a date (optional) for the document based on the latest
94+
# git commit of any of its (obvious) constituent parts.
95+
%_date.sty: %.tex
96+
for f in $(wildcard $(dir $<)*.tex); do git log -n 1 --format="%at" -- $$f; done | sort -nr | head -1 | gawk '{print "\\date{",strftime("%B %e, %Y", $$1),"}"}' > $@
97+
cmp $@ $(dir $<)$@ || cp $@ $(dir $<)

doc/style/scala.tex

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
% "define" Scala
2+
\usepackage[T1]{fontenc}
3+
\usepackage[scaled=0.82]{beramono}
4+
\usepackage{microtype}
5+
6+
\sbox0{\small\ttfamily A}
7+
\edef\mybasewidth{\the\wd0 }
8+
9+
\lstdefinelanguage{scala}{
10+
morekeywords={abstract,case,catch,class,def,%
11+
do,else,extends,false,final,finally,%
12+
for,if,implicit,import,match,mixin,%
13+
new,null,object,override,package,%
14+
private,protected,requires,return,sealed,%
15+
super,this,throw,trait,true,try,%
16+
type,val,var,while,with,yield},
17+
sensitive=true,
18+
morecomment=[l]{//},
19+
morecomment=[n]{/*}{*/},
20+
morestring=[b]",
21+
morestring=[b]',
22+
morestring=[b]"""
23+
}
24+
25+
\usepackage{color}
26+
\definecolor{dkgreen}{rgb}{0,0.6,0}
27+
\definecolor{gray}{rgb}{0.5,0.5,0.5}
28+
\definecolor{mauve}{rgb}{0.58,0,0.82}
29+
30+
% Default settings for code listings
31+
\lstset{frame=tb,
32+
language=scala,
33+
aboveskip=3mm,
34+
belowskip=3mm,
35+
showstringspaces=false,
36+
columns=fixed, % basewidth=\mybasewidth,
37+
basicstyle={\small\ttfamily},
38+
numbers=none,
39+
numberstyle=\footnotesize\color{gray},
40+
% identifierstyle=\color{red},
41+
keywordstyle=\color{blue},
42+
commentstyle=\color{dkgreen},
43+
stringstyle=\color{mauve},
44+
frame=single,
45+
breaklines=true,
46+
breakatwhitespace=true,
47+
procnamekeys={def, val, var, class, trait, object, extends},
48+
procnamestyle=\ttfamily\color{red},
49+
tabsize=2
50+
}
51+
52+
\lstnewenvironment{scala}[1][]
53+
{\lstset{language=scala,#1}}
54+
{}
55+
\lstnewenvironment{cpp}[1][]
56+
{\lstset{language=C++,#1}}
57+
{}
58+
\lstnewenvironment{bash}[1][]
59+
{\lstset{language=bash,#1}}
60+
{}
61+
\lstnewenvironment{verilog}[1][]
62+
{\lstset{language=verilog,#1}}
63+
{}
64+

doc/style/talk.tex

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
\lstset{basicstyle={\footnotesize\ttfamily}}
2+
3+
\usetheme[height=8mm]{Rochester}
4+
\setbeamersize{text margin left=3mm}
5+
\setbeamersize{text margin right=3mm}
6+
\setbeamertemplate{navigation symbols}{}
7+
8+
\definecolor{Cobalt}{rgb}{0.25,0.125,0.70}
9+
\definecolor{RedOrange}{rgb}{0.8,0.25,0.0}
10+
% \definecolor{RedOrange}{rgb}{0.8,0.775,0.25}
11+
\def\frametitledefaultcolor{Cobalt}
12+
\def\frametitleproblemcolor{RedOrange}
13+
14+
\lstset{basicstyle={\footnotesize\ttfamily}}
15+
16+
\setbeamertemplate{frametitle}
17+
{
18+
\vskip-7mm
19+
\textbf{\insertframetitle}\hfill\insertframenumber
20+
}
21+
\setbeamercolor{frametitle}{bg=\frametitledefaultcolor}
22+
23+
\newenvironment{sample}{\VerbatimEnvironment\begin{footnotesize}\begin{semiverbatim}}{\end{semiverbatim}\end{footnotesize}}
24+
25+
\newenvironment{FramedSemiVerb}%
26+
{\begin{Sbox}\begin{minipage}{.94\textwidth}\begin{semiverbatim}}%
27+
{\end{semiverbatim}\end{minipage}\end{Sbox}
28+
\setlength{\fboxsep}{8pt}\fbox{\TheSbox}}
29+
30+
\newenvironment{FramedVerb}%
31+
{\VerbatimEnvironment
32+
\begin{Sbox}\begin{minipage}{.94\textwidth}\begin{Verbatim}}%
33+
{\end{Verbatim}\end{minipage}\end{Sbox}
34+
\setlength{\fboxsep}{8pt}\fbox{\TheSbox}}
35+
36+
% \newenvironment{sample}{\VerbatimEnvironment\begin{footnotesize}\begin{Verbatim}}{\end{Verbatim}\end{footnotesize}}
37+
\newcommand{\code}[1]{\begin{footnotesize}{\tt #1}\end{footnotesize}}
38+
\newcommand{\comment}[1]{{\color{Green}\it\smaller #1}}

doc/tutorial/figs/DUT.pdf

15.7 KB
Binary file not shown.

doc/tutorial/figs/condupdates.pdf

24.6 KB
Binary file not shown.

doc/tutorial/figs/cpu.png

384 KB
Loading

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy