HW11: done 2 and main document

This commit is contained in:
Claudio Maggioni 2018-12-17 14:55:19 +01:00
parent 74ac5423e4
commit 71d46ca8b5
5 changed files with 174 additions and 36 deletions

BIN
Homework 11/Homework 11.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
\documentclass[12pt]{scrartcl}
\usepackage[margin=3cm]{geometry}
\usepackage{tikz}
\usepackage{pgf}
\title{Computer Architecture -- Homework 11}
\author{Tommaso Rodolfo Masera \and Claudio Maggioni}
\begin{document}
\maketitle
\section{Exercise 1}
Please find our solution in the finite state diagram below.
\begin{figure}[h]
\small
\resizebox{\ifdim\width>\linewidth\linewidth\else\width\fi}{!}{\input{ex1}}
\end{figure}
\section{Exercise 2}
Since the number of conditional branches is 5 and the probability of each prediction being right is 95\%,
the probability of the prefetching being in the right track is:
$95\% \times 95\% \times 95\% \times 95\% \times 95\% \approx 77.4\%$.
\section{Exercise 3}
Please find our solution in the file \texttt{hw11\_ex3.ods}.
\end{document}

Binary file not shown.

View File

@ -1,7 +1,7 @@
% Graphic for TeX using PGF
% Title: /home/claudio/MacOS/Git/CAHomework/Homework 11/ex1.dia
% Creator: Dia v0.97.3
% CreationDate: Thu Dec 13 14:55:23 2018
% CreationDate: Mon Dec 17 14:28:05 2018
% For: claudio
% \usepackage{tikz}
% The following commands are not supported in PSTricks at present
@ -20,7 +20,7 @@
\pgfsetfillcolor{dialinecolor}
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{24.621636\du}{10.373318\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfpathellipse{\pgfpoint{24.621664\du}{10.373322\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfusepath{fill}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -28,12 +28,20 @@
\pgfsetmiterjoin
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\pgfpathellipse{\pgfpoint{24.621636\du}{10.373318\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfpathellipse{\pgfpoint{24.621664\du}{10.373322\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfusepath{stroke}
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (24.621636\du,10.821893\du){000};
\node at (24.621664\du,9.946655\du){000};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (24.621664\du,10.511100\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (24.621664\du,11.075544\du){no branch};
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{51.098364\du}{10.466682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
@ -49,10 +57,22 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (51.098364\du,10.915257\du){011};
\node at (51.098364\du,9.757793\du){011};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (51.098364\du,10.322238\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (51.098364\du,10.886682\du){no branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (51.098364\du,11.451126\du){one more time};
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{37.613364\du}{10.346682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfpathellipse{\pgfpoint{38.013364\du}{10.396682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfusepath{fill}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -60,12 +80,24 @@
\pgfsetmiterjoin
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\pgfpathellipse{\pgfpoint{37.613364\du}{10.346682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfpathellipse{\pgfpoint{38.013364\du}{10.396682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfusepath{stroke}
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (37.613364\du,10.795257\du){001};
\node at (38.013364\du,9.687793\du){001};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (38.013364\du,10.252238\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (38.013364\du,10.816682\du){no branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (38.013364\du,11.381126\du){one more time};
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{30.348364\du}{20.416682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
@ -81,11 +113,27 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (30.348364\du,20.865257\du){010};
\node at (30.348364\du,19.425571\du){010};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (38.013364\du,10.396682\du){};
\node at (30.348364\du,19.990015\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (30.348364\du,20.554460\du){no branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (30.348364\du,21.118904\du){(branch before the };
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (30.348364\du,21.683349\du){last taken)};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (38.013400\du,10.396700\du){};
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
\pgfsetdash{}{0pt}
@ -97,7 +145,7 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\draw (29.200000\du,10.373318\du)--(33.035000\du,10.346682\du);
\draw (29.200028\du,10.373322\du)--(33.435000\du,10.396682\du);
}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -110,7 +158,7 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\draw (42.241183\du,10.409033\du)--(46.520000\du,10.466682\du);
\draw (42.641807\du,10.434769\du)--(46.520000\du,10.466682\du);
}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -123,7 +171,7 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\draw (35.861300\du,14.528791\du)--(33.492797\du,17.058385\du);
\draw (36.261300\du,14.578791\du)--(33.623143\du,17.183465\du);
}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -136,7 +184,7 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\draw (27.770800\du,16.615667\du)--(26.373700\du,14.555427\du);
\draw (27.770818\du,16.615669\du)--(26.373728\du,14.555431\du);
}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -149,7 +197,7 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\draw (32.100428\du,16.234573\du)--(34.375972\du,13.547529\du);
\draw (32.100428\du,16.234573\du)--(34.775972\du,13.597529\du);
}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -187,7 +235,7 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\pgfpathmoveto{\pgfpoint{21.384321\du}{7.172481\du}}
\pgfpathmoveto{\pgfpoint{21.384348\du}{7.172485\du}}
\pgfpatharc{279}{82}{3.232560\du and 3.232560\du}
\pgfusepath{stroke}
}
@ -209,7 +257,7 @@
\node[anchor=west] at (30.635000\du,14.765000\du){Branch};
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{25.421636\du}{35.723318\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfpathellipse{\pgfpoint{25.421664\du}{35.723282\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfusepath{fill}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -217,12 +265,24 @@
\pgfsetmiterjoin
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\pgfpathellipse{\pgfpoint{25.421636\du}{35.723318\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfpathellipse{\pgfpoint{25.421664\du}{35.723282\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
\pgfusepath{stroke}
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (25.421636\du,36.171893\du){100};
\node at (25.421664\du,35.014393\du){100};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (25.421664\du,35.578838\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (25.421664\du,36.143282\du){branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (25.421664\du,36.707726\du){one more time};
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{54.248364\du}{35.716682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
@ -238,7 +298,15 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (54.248364\du,36.165257\du){111};
\node at (54.248364\du,35.290015\du){111};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (54.248364\du,35.854460\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (54.248364\du,36.418904\du){branch};
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{39.913364\du}{35.696682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
@ -254,7 +322,19 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (39.913364\du,36.145257\du){110};
\node at (39.913364\du,34.987793\du){110};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (39.913364\du,35.552238\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (39.913364\du,36.116682\du){branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (39.913364\du,36.681126\du){one more time};
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
\pgfpathellipse{\pgfpoint{47.798364\du}{24.666682\du}}{\pgfpoint{4.578364\du}{0\du}}{\pgfpoint{0\du}{4.526682\du}}
@ -270,11 +350,27 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (47.798364\du,25.115257\du){101};
\node at (47.798364\du,23.675571\du){101};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (41.163364\du,35.646682\du){};
\node at (47.798364\du,24.240015\du){Predict};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (47.798364\du,24.804460\du){branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (47.798364\du,25.368904\du){(branch before the};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (47.798364\du,25.933349\du){last taken)};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (41.163400\du,35.646700\du){};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
@ -305,7 +401,7 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (61.885000\du,35.848393\du){Branch};
\node[anchor=west] at (61.885000\du,35.848400\du){Branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
@ -334,7 +430,7 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\draw (35.335000\du,35.696682\du)--(30.000000\du,35.723318\du);
\draw (35.335000\du,35.696682\du)--(30.000028\du,35.723282\du);
}
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
@ -347,12 +443,12 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\draw (28.659028\du,32.522471\du)--(43.568507\du,26.398968\du);
\draw (28.659056\du,32.522434\du)--(43.568507\du,26.398968\du);
}
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (33.585000\du,29.248403\du){Branch};
\node[anchor=west] at (33.585000\du,29.248400\du){Branch};
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
\pgfsetdash{}{0pt}
@ -369,7 +465,7 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (40.435000\du,29.948403\du){Branch};
\node[anchor=west] at (40.435000\du,29.948400\du){Branch};
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
\pgfsetdash{}{0pt}
@ -386,11 +482,11 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (52.935000\du,28.948403\du){Branch};
\node[anchor=west] at (52.935000\du,28.948400\du){Branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (40.050000\du,30.083403\du){};
\node[anchor=west] at (40.050000\du,30.083400\du){};
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
\pgfsetdash{}{0pt}
@ -407,7 +503,7 @@
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (44.485000\du,31.498403\du){No branch};
\node[anchor=west] at (44.485000\du,31.498400\du){No branch};
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
\pgfsetdash{}{0pt}
@ -419,14 +515,14 @@
\pgfsetarrowsend{stealth}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\pgfpathmoveto{\pgfpoint{21.384620\du}{13.573665\du}}
\pgfpatharc{217}{139}{14.953734\du and 14.953734\du}
\pgfpathmoveto{\pgfpoint{21.384648\du}{13.573669\du}}
\pgfpatharc{217}{139}{14.953678\du and 14.953678\du}
\pgfusepath{stroke}
}
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (18.900000\du,23.149714\du){No branch};
\node[anchor=west] at (18.900000\du,23.149700\du){No branch};
\pgfsetlinewidth{0.100000\du}
\pgfsetdash{}{0pt}
\pgfsetdash{}{0pt}
@ -439,11 +535,19 @@
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\pgfpathmoveto{\pgfpoint{57.484943\du}{32.517508\du}}
\pgfpatharc{26}{-38}{19.042867\du and 19.042867\du}
\pgfpatharc{26}{-38}{19.042892\du and 19.042892\du}
\pgfusepath{stroke}
}
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (56.685000\du,23.464714\du){Branch};
\node[anchor=west] at (56.685000\du,23.464700\du){Branch};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (24.621664\du,10.373322\du){};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node[anchor=west] at (51.098364\du,10.466682\du){};
\end{tikzpicture}

Binary file not shown.