Commit 0deee8fb authored by Jules Saget's avatar Jules Saget
Browse files

Clean the fig making process a bit

parent 0a44d8e2
built_figs= comparator.pdf simple_graph_reductions.pdf ski_combinators.pdf 4ph.pdf add-sub.pdf mul.pdf clean.pdf tree.pdf add_fsm_ab_add.pdf add_fsm_ab_read_a.pdf add_fsm_ab_read_b.pdf add_fsm_done.pdf add_fsm_final_check.pdf add_fsm_final_link.pdf add_fsm_idle.pdf
built_figs= comparator.pdf simple_graph_reductions.pdf ski_combinators.pdf 4ph.pdf add-sub.pdf mul.pdf clean.pdf tree.pdf add_fsm.pdf
other_figs= andor.png gr_ex_0.pdf gr_ex_1.pdf gr_ex_2.pdf gr_ex_3.pdf gr_ex_4.pdf
figs: $(built_figs) $(other_figs)
figs: $(built_figs) $(other_figs) add_fsm_figs
add_fsm_figs:
./generate_add_fsm_highlights.sh
%.pdf: %.gv
dot -o$@ -Tpdf $<
clean:
rm -f $(built_figs)
./clean_add_fsm_highlights.sh
......@@ -21,7 +21,7 @@ digraph addsub_FSM {
style = filled;
color = white;
A_CHECK [style = filled, color = lightgrey];
A_CHECK [style = filled, fillcolor = lightgrey];
A_ALLOC;
A_WRITE;
A_READ;
......@@ -36,7 +36,7 @@ digraph addsub_FSM {
style = filled;
color = white;
FINAL_CHECK [style = filled, color = lightgrey];
FINAL_CHECK [style = filled, fillcolor = lightgrey];
FINAL_LINK;
FINAL_ALLOC;
FINAL_WRITE;
......@@ -51,7 +51,7 @@ digraph addsub_FSM {
style = filled;
color = white;
B_CHECK [style = filled, color = lightgrey];
B_CHECK [style = filled, fillcolor = lightgrey];
B_ALLOC;
B_WRITE;
B_READ;
......
digraph addsub_FSM {
IDLE;
DONE;
subgraph cluster_AB {
style = filled;
color = white;
AB_ALLOC;
AB_WRITE;
AB_READ_A;
AB_READ_B;
AB_ADDSUB;
AB_ALLOC -> AB_WRITE -> AB_READ_A -> AB_READ_B -> AB_ADDSUB -> AB_ALLOC;
label = "A unfinished, B unfinished";
}
subgraph cluster_A {
style = filled;
color = white;
A_CHECK [style = filled, color = lightgrey];
A_ALLOC;
A_WRITE;
A_READ;
A_ADDSUB;
A_CHECK -> A_ALLOC -> A_WRITE -> A_READ -> A_ADDSUB -> A_CHECK;
A_CHECK -> A_LINK;
label = "A unfinished, B finished";
}
subgraph cluster_FINAL {
style = filled;
color = white;
FINAL_CHECK [style = filled, color = lightgrey];
FINAL_LINK;
FINAL_ALLOC;
FINAL_WRITE;
FINAL_LAST_WRITE;
FINAL_CHECK -> FINAL_LINK;
FINAL_CHECK -> FINAL_ALLOC -> FINAL_WRITE -> FINAL_LAST_WRITE;
label = "A finished, B finished"
}
subgraph cluster_B {
style = filled;
color = white;
B_CHECK [style = filled, color = lightgrey];
B_ALLOC;
B_WRITE;
B_READ;
B_ADDSUB;
B_CHECK -> B_LINK;
B_CHECK -> B_ALLOC -> B_WRITE -> B_READ -> B_ADDSUB -> B_CHECK;
label = "A finished, B unfinished";
}
IDLE -> AB_READ_A;
AB_ADDSUB -> A_CHECK;
AB_ADDSUB -> B_CHECK;
AB_ADDSUB -> FINAL_CHECK;
A_LINK -> DONE;
B_LINK -> DONE;
FINAL_LINK -> DONE;
FINAL_LAST_WRITE -> DONE;
A_CHECK -> FINAL_CHECK;
B_CHECK -> FINAL_CHECK;
}
digraph addsub_FSM {
IDLE;
DONE;
subgraph cluster_AB {
style = filled;
color = white;
AB_ALLOC;
AB_WRITE;
AB_READ_A;
AB_READ_B;
AB_ADDSUB;
AB_ALLOC -> AB_WRITE -> AB_READ_A -> AB_READ_B -> AB_ADDSUB -> AB_ALLOC;
label = "A unfinished, B unfinished";
}
subgraph cluster_A {
style = filled;
color = white;
A_CHECK [style = filled, color = lightgrey];
A_ALLOC;
A_WRITE;
A_READ;
A_ADDSUB;
A_CHECK -> A_ALLOC -> A_WRITE -> A_READ -> A_ADDSUB -> A_CHECK;
A_CHECK -> A_LINK;
label = "A unfinished, B finished";
}
subgraph cluster_FINAL {
style = filled;
color = white;
FINAL_CHECK [style = filled, color = lightgrey];
FINAL_LINK;
FINAL_ALLOC;
FINAL_WRITE;
FINAL_LAST_WRITE;
FINAL_CHECK -> FINAL_LINK;
FINAL_CHECK -> FINAL_ALLOC -> FINAL_WRITE -> FINAL_LAST_WRITE;
label = "A finished, B finished"
}
subgraph cluster_B {
style = filled;
color = white;
B_CHECK [style = filled, color = lightgrey];
B_ALLOC;
B_WRITE;
B_READ;
B_ADDSUB;
B_CHECK -> B_LINK;
B_CHECK -> B_ALLOC -> B_WRITE -> B_READ -> B_ADDSUB -> B_CHECK;
label = "A finished, B unfinished";
}
IDLE -> AB_READ_A;
AB_ADDSUB -> A_CHECK;
AB_ADDSUB -> B_CHECK;
AB_ADDSUB -> FINAL_CHECK;
A_LINK -> DONE;
B_LINK -> DONE;
FINAL_LINK -> DONE;
FINAL_LAST_WRITE -> DONE;
A_CHECK -> FINAL_CHECK;
B_CHECK -> FINAL_CHECK;
}
digraph addsub_FSM {
IDLE;
DONE;
subgraph cluster_AB {
style = filled;
color = white;
AB_ALLOC;
AB_WRITE;
AB_READ_A;
AB_READ_B;
AB_ADDSUB;
AB_ALLOC -> AB_WRITE -> AB_READ_A -> AB_READ_B -> AB_ADDSUB -> AB_ALLOC;
label = "A unfinished, B unfinished";
}
subgraph cluster_A {
style = filled;
color = white;
A_CHECK [style = filled, color = lightgrey];
A_ALLOC;
A_WRITE;
A_READ;
A_ADDSUB;
A_CHECK -> A_ALLOC -> A_WRITE -> A_READ -> A_ADDSUB -> A_CHECK;
A_CHECK -> A_LINK;
label = "A unfinished, B finished";
}
subgraph cluster_FINAL {
style = filled;
color = white;
FINAL_CHECK [style = filled, color = lightgrey];
FINAL_LINK;
FINAL_ALLOC;
FINAL_WRITE;
FINAL_LAST_WRITE;
FINAL_CHECK -> FINAL_LINK;
FINAL_CHECK -> FINAL_ALLOC -> FINAL_WRITE -> FINAL_LAST_WRITE;
label = "A finished, B finished"
}
subgraph cluster_B {
style = filled;
color = white;
B_CHECK [style = filled, color = lightgrey];
B_ALLOC;
B_WRITE;
B_READ;
B_ADDSUB;
B_CHECK -> B_LINK;
B_CHECK -> B_ALLOC -> B_WRITE -> B_READ -> B_ADDSUB -> B_CHECK;
label = "A finished, B unfinished";
}
IDLE -> AB_READ_A;
AB_ADDSUB -> A_CHECK;
AB_ADDSUB -> B_CHECK;
AB_ADDSUB -> FINAL_CHECK;
A_LINK -> DONE;
B_LINK -> DONE;
FINAL_LINK -> DONE;
FINAL_LAST_WRITE -> DONE;
A_CHECK -> FINAL_CHECK;
B_CHECK -> FINAL_CHECK;
}
digraph addsub_FSM {
IDLE;
DONE;
subgraph cluster_AB {
style = filled;
color = white;
AB_ALLOC;
AB_WRITE;
AB_READ_A;
AB_READ_B;
AB_ADDSUB;
AB_ALLOC -> AB_WRITE -> AB_READ_A -> AB_READ_B -> AB_ADDSUB -> AB_ALLOC;
label = "A unfinished, B unfinished";
}
subgraph cluster_A {
style = filled;
color = white;
A_CHECK [style = filled, color = lightgrey];
A_ALLOC;
A_WRITE;
A_READ;
A_ADDSUB;
A_CHECK -> A_ALLOC -> A_WRITE -> A_READ -> A_ADDSUB -> A_CHECK;
A_CHECK -> A_LINK;
label = "A unfinished, B finished";
}
subgraph cluster_FINAL {
style = filled;
color = white;
FINAL_CHECK [style = filled, color = lightgrey];
FINAL_LINK;
FINAL_ALLOC;
FINAL_WRITE;
FINAL_LAST_WRITE;
FINAL_CHECK -> FINAL_LINK;
FINAL_CHECK -> FINAL_ALLOC -> FINAL_WRITE -> FINAL_LAST_WRITE;
label = "A finished, B finished"
}
subgraph cluster_B {
style = filled;
color = white;
B_CHECK [style = filled, color = lightgrey];
B_ALLOC;
B_WRITE;
B_READ;
B_ADDSUB;
B_CHECK -> B_LINK;
B_CHECK -> B_ALLOC -> B_WRITE -> B_READ -> B_ADDSUB -> B_CHECK;
label = "A finished, B unfinished";
}
IDLE -> AB_READ_A;
AB_ADDSUB -> A_CHECK;
AB_ADDSUB -> B_CHECK;
AB_ADDSUB -> FINAL_CHECK;
A_LINK -> DONE;
B_LINK -> DONE;
FINAL_LINK -> DONE;
FINAL_LAST_WRITE -> DONE;
A_CHECK -> FINAL_CHECK;
B_CHECK -> FINAL_CHECK;
}
digraph addsub_FSM {
IDLE;
DONE;
subgraph cluster_AB {
style = filled;
color = white;
AB_ALLOC;
AB_WRITE;
AB_READ_A;
AB_READ_B;
AB_ADDSUB;
AB_ALLOC -> AB_WRITE -> AB_READ_A -> AB_READ_B -> AB_ADDSUB -> AB_ALLOC;
label = "A unfinished, B unfinished";
}
subgraph cluster_A {
style = filled;
color = white;
A_CHECK [style = filled, color = lightgrey];
A_ALLOC;
A_WRITE;
A_READ;
A_ADDSUB;
A_CHECK -> A_ALLOC -> A_WRITE -> A_READ -> A_ADDSUB -> A_CHECK;
A_CHECK -> A_LINK;
label = "A unfinished, B finished";
}
subgraph cluster_FINAL {
style = filled;
color = white;
FINAL_CHECK [style = filled, color = lightgrey];
FINAL_LINK;
FINAL_ALLOC;
FINAL_WRITE;
FINAL_LAST_WRITE;
FINAL_CHECK -> FINAL_LINK;
FINAL_CHECK -> FINAL_ALLOC -> FINAL_WRITE -> FINAL_LAST_WRITE;
label = "A finished, B finished"
}
subgraph cluster_B {
style = filled;
color = white;
B_CHECK [style = filled, color = lightgrey];
B_ALLOC;
B_WRITE;
B_READ;
B_ADDSUB;
B_CHECK -> B_LINK;
B_CHECK -> B_ALLOC -> B_WRITE -> B_READ -> B_ADDSUB -> B_CHECK;
label = "A finished, B unfinished";
}
IDLE -> AB_READ_A;
AB_ADDSUB -> A_CHECK;
AB_ADDSUB -> B_CHECK;
AB_ADDSUB -> FINAL_CHECK;
A_LINK -> DONE;
B_LINK -> DONE;
FINAL_LINK -> DONE;
FINAL_LAST_WRITE -> DONE;
A_CHECK -> FINAL_CHECK;
B_CHECK -> FINAL_CHECK;
}
digraph addsub_FSM {
IDLE;
DONE;
subgraph cluster_AB {
style = filled;
color = white;
AB_ALLOC;
AB_WRITE;
AB_READ_A;
AB_READ_B;
AB_ADDSUB;
AB_ALLOC -> AB_WRITE -> AB_READ_A -> AB_READ_B -> AB_ADDSUB -> AB_ALLOC;
label = "A unfinished, B unfinished";
}
subgraph cluster_A {
style = filled;
color = white;
A_CHECK [style = filled, color = lightgrey];
A_ALLOC;
A_WRITE;
A_READ;
A_ADDSUB;
A_CHECK -> A_ALLOC -> A_WRITE -> A_READ -> A_ADDSUB -> A_CHECK;
A_CHECK -> A_LINK;
label = "A unfinished, B finished";
}
subgraph cluster_FINAL {
style = filled;
color = white;
FINAL_CHECK [style = filled, color = lightgrey];
FINAL_LINK;
FINAL_ALLOC;
FINAL_WRITE;
FINAL_LAST_WRITE;
FINAL_CHECK -> FINAL_LINK;
FINAL_CHECK -> FINAL_ALLOC -> FINAL_WRITE -> FINAL_LAST_WRITE;
label = "A finished, B finished"
}
subgraph cluster_B {
style = filled;
color = white;
B_CHECK [style = filled, color = lightgrey];
B_ALLOC;
B_WRITE;
B_READ;
B_ADDSUB;
B_CHECK -> B_LINK;
B_CHECK -> B_ALLOC -> B_WRITE -> B_READ -> B_ADDSUB -> B_CHECK;
label = "A finished, B unfinished";
}
IDLE -> AB_READ_A;
AB_ADDSUB -> A_CHECK;
AB_ADDSUB -> B_CHECK;
AB_ADDSUB -> FINAL_CHECK;
A_LINK -> DONE;
B_LINK -> DONE;
FINAL_LINK -> DONE;
FINAL_LAST_WRITE -> DONE;
A_CHECK -> FINAL_CHECK;
B_CHECK -> FINAL_CHECK;
}
add_fsm_states="idle done ab_read_a ab_read_b ab_add ab_alloc ab_write a_check a_link a_alloc a_write a_read a_addsub b_check b_link b_alloc b_write b_read b_addsub final_check final_link final_alloc final_write final_last_write"
for state in $add_fsm_states
do
rm -f add_fsm_$state.pdf
rm -f add_fsm_$state.gv
done
add_fsm_states="idle done ab_read_a ab_read_b ab_add ab_alloc ab_write a_check a_link a_alloc a_write a_read a_addsub b_check b_link b_alloc b_write b_read b_addsub final_check final_link final_alloc final_write final_last_write"
for state in $add_fsm_states
do
echo $state
python generate_fig.py add_fsm $state
make add_fsm_$state.pdf
done
import sys
argument_list = sys.argv
def is_target_def(line, target):
return (target in line and ';' in line and "->" not in line)
def add_color(def_line): # Always add red
if ']' in def_line:
[begining, end] = def_line.split(']')
new_def_line = begining + ", color = red]" + end
return new_def_line
else:
[begining, end] = def_line.split(';')
new_def_line = begining + "[style = filled, fillcolor = white, color = red];" + end
return new_def_line
base_filename = argument_list[1].split(".gv")[0]
target_name = argument_list[2]
target_filename = base_filename + '_' + target_name.lower()
target = target_name.upper()
base_file = open(base_filename+".gv","rt")
target_file = open(target_filename+".gv", "wt")
for line in base_file:
if is_target_def(line, target):
target_file.write(add_color(line))
else:
target_file.write(line)
base_file.close()
target_file.close()
......@@ -128,13 +128,13 @@
\begin{frame}{1 + 2}
\begin{minipage}{0.34\textwidth}
\texttt{001 + 010}
\texttt{001 + 010}:
\begin{itemize}
\item<2-7> Read \texttt{A}: \texttt{001}
\item<3-7> Read \texttt{B}: \texttt{010}
\item<4-7> Add \texttt{A} and \texttt{B}: \texttt{011}
\item<5-7> Go into final mode
\item<6-7> Everything is fine, write the result: \texttt{011}
\item<5-7> Go into final mode: everything is fine
\item<6-7> Write the result: \texttt{011}
\item<7> Done!
\end{itemize}
\end{minipage}
......@@ -153,6 +153,37 @@
\end{minipage}
\end{frame}
\begin{frame}{1+3}
\begin{minipage}{0.34\textwidth}
\texttt{001+011}:
\begin{itemize}
\item<2-9> Read \texttt{A}: \texttt{001}
\item<3-9> Read \texttt{B}: \texttt{011}
\item<4-9> Add \texttt{A} and \texttt{B}: \texttt{100}
\item<5-9> Go into final mode: there is a sign problem!
\item<6-9> Allocate space for the next chunk
\item<7-9> Write the first chunk: \texttt{·100}
\item<8-9> Write the last chunk: \texttt{000}
\item<9> Done!
\end{itemize}
\end{minipage}
\begin{minipage}{0.65\textwidth}
\begin{figure}[h]
\centering
\only<1>{\includegraphics[width=\textwidth]{figures/add_fsm_idle.pdf}}
\only<2>{\includegraphics[width=\textwidth]{figures/add_fsm_ab_read_a.pdf}}
\only<3>{\includegraphics[width=\textwidth]{figures/add_fsm_ab_read_b.pdf}}
\only<4>{\includegraphics[width=\textwidth]{figures/add_fsm_ab_add.pdf}}
\only<5>{\includegraphics[width=\textwidth]{figures/add_fsm_final_check.pdf}}
\only<6>{\includegraphics[width=\textwidth]{figures/add_fsm_final_alloc.pdf}}
\only<7>{\includegraphics[width=\textwidth]{figures/add_fsm_final_write.pdf}}
\only<8>{\includegraphics[width=\textwidth]{figures/add_fsm_final_last_write.pdf}}
\only<9>{\includegraphics[width=\textwidth]{figures/add_fsm_done.pdf}}
\label{fig:add_ex_2}
\end{figure}
\end{minipage}
\end{frame}
\subsection{Multiplication Unit}
\section*{}
......
Supports Markdown
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