diff --git a/W3/main.aux b/W3/main.aux index fa1ce6f..01d334f 100644 --- a/W3/main.aux +++ b/W3/main.aux @@ -8,5 +8,6 @@ \@writefile{toc}{\contentsline {subsection}{\numberline {3)}\texttt {z := x >= y, w := !z}}{2}{}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {Task 3}}{3}{}\protected@file@percent } \@writefile{toc}{\contentsline {subsubsection}{\numberline {a)}}{3}{}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{\numberline {b)}}{3}{}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {A}Intermediate code generation}{4}{}\protected@file@percent } \gdef \@abspage@last{9} diff --git a/W3/main.fdb_latexmk b/W3/main.fdb_latexmk index e4ad64e..8121129 100644 --- a/W3/main.fdb_latexmk +++ b/W3/main.fdb_latexmk @@ -1,5 +1,5 @@ # Fdb version 3 -["lualatex"] 1653221037 "/home/nikolaj/Code/Datalogi/2022B4-IPS/IPS_W-assignments/W3/main.tex" "main.pdf" "main" 1653221038 +["lualatex"] 1653406447 "/home/nikolaj/Code/Datalogi/2022B4-IPS/IPS_W-assignments/W3/main.tex" "main.pdf" "main" 1653406448 "/home/nikolaj/.local/share/fonts/AntikorMono/AntikorMono-Medium.ttf" 1611081972 103940 8e55892035a16215c54dd867754fccc1 "" "/home/nikolaj/.texlive/texmf-var/luatex-cache/generic/fonts/otl/antikormono-medium.luc" 1651323665 104754 23ebedc62154e273369ad441e4fed323 "" "/home/nikolaj/.texlive/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-bold.luc" 1650282221 128371 e7304f80c7b50597b0633dcda00e60a9 "" @@ -14,7 +14,7 @@ "/home/nikolaj/.texlive/texmf-var/luatex-cache/generic/fonts/otl/lmroman9-regular.luc" 1650456839 127921 c90eb6ae5f8a306e2567001f7c35a1ca "" "/home/nikolaj/.texlive/texmf-var/luatex-cache/generic/names/luaotfload-lookup-cache.luc" 1652619475 1364 5feba282216f2b9f6eec7317e7dda3c7 "" "/home/nikolaj/.texlive/texmf-var/luatex-cache/generic/names/luaotfload-names.luc.gz" 1651323659 341600 1597a54d96fec9bc135c0799b8b573f7 "" - "/home/nikolaj/Code/Datalogi/2022B4-IPS/IPS_W-assignments/W3/main.tex" 1653221036 2392 74b31390c1a1d4d553334d995ef6139d "" + "/home/nikolaj/Code/Datalogi/2022B4-IPS/IPS_W-assignments/W3/main.tex" 1653406446 3329 7299ddbcaa875197418b97c9a359bb4c "" "/usr/share/fonts/OTF/lmroman10-bold.otf" 1593426288 111240 0af0b64d6d3df41bead3f9de314afbd4 "" "/usr/share/fonts/OTF/lmroman10-regular.otf" 1593426288 111536 ae9d1b331000d544f47e5223081b7b54 "" "/usr/share/fonts/OTF/lmroman12-bold.otf" 1593426288 110496 b9c8767d4cc3bf3f4b21f676bf89aa78 "" @@ -203,8 +203,8 @@ "/var/lib/texmf/web2c/luahbtex/lualatex.fmt" 1652348949 4561207 f654a70ada34c37686970d61677ed13a "" "appendix_a.tex" 1652625160 6037 54a4e11630243c2fa19813e803314f71 "" "fasto.sty" 1652614481 1401 a6d806798c61bebd8e4080170252a195 "" - "main.aux" 1653221038 1079 4bcb71dc4a4206d16b1191cdbcb8b458 "lualatex" - "main.tex" 1653221036 2392 74b31390c1a1d4d553334d995ef6139d "" + "main.aux" 1653406448 1174 170777a14de12724a6535c11757920bc "lualatex" + "main.tex" 1653406446 3329 7299ddbcaa875197418b97c9a359bb4c "" (generated) "main.aux" "main.log" diff --git a/W3/main.log b/W3/main.log index 480ec3e..676552c 100644 --- a/W3/main.log +++ b/W3/main.log @@ -1,4 +1,4 @@ -This is LuaHBTeX, Version 1.15.0 (TeX Live 2022/Arch Linux) (format=lualatex 2022.5.12) 22 MAY 2022 14:03 +This is LuaHBTeX, Version 1.15.0 (TeX Live 2022/Arch Linux) (format=lualatex 2022.5.12) 24 MAY 2022 17:34 restricted system commands enabled. file:line:error style messages enabled. **/home/nikolaj/Code/Datalogi/2022B4-IPS/IPS_W-assignments/W3/main.tex @@ -652,15 +652,15 @@ LaTeX Font Warning: Some font shapes were not available, defaults substituted. Here is how much of LuaTeX's memory you used: 17435 strings out of 477762 - 125009,794899 words of node,token memory allocated + 244184,794899 words of node,token memory allocated 506 words of node memory still in use: 6 hlist, 2 vlist, 2 rule, 2 glue, 4 kern, 1 glyph, 7 attribute, 55 glue_spec, 7 attribute_list, 2 write nodes - avail lists: 2:2216,3:145,4:2284,5:2362,6:102,7:4882,8:47,9:6570,10:7,11:156 + avail lists: 1:1,2:3102,3:145,4:4516,5:4658,6:103,7:7252,8:47,9:12336,10:20,11:390 37561 multiletter control sequences out of 65536+600000 61 fonts using 5084231 bytes - 104i,7n,101p,518b,488s stack positions out of 5000i,500n,10000p,200000b,80000s + 104i,7n,101p,518b,511s stack positions out of 5000i,500n,10000p,200000b,80000s -Output written on main.pdf (9 pages, 123857 bytes). +Output written on main.pdf (9 pages, 126578 bytes). PDF statistics: 116 PDF objects out of 1000 (max. 8388607) 75 compressed objects within 1 object stream diff --git a/W3/main.pdf b/W3/main.pdf index bda3b92..266fc87 100644 Binary files a/W3/main.pdf and b/W3/main.pdf differ diff --git a/W3/main.synctex.gz b/W3/main.synctex.gz index 23367e5..eb74fd4 100644 Binary files a/W3/main.synctex.gz and b/W3/main.synctex.gz differ diff --git a/W3/main.tex b/W3/main.tex index 747122d..6e10f96 100644 --- a/W3/main.tex +++ b/W3/main.tex @@ -16,7 +16,7 @@ \setlength{\parskip}{5pt} \setlength{\parindent}{0pt} -\title{W2 - IPS} +\title{W3 - IPS} \author{Nikolaj Gade (qhp695)} \date{May 2022} @@ -135,15 +135,43 @@ slt w, x, y \section{} \subsubsection{} \begin{lstlisting} -bool* y = (bool*)malloc(n*4); +int* y = malloc(n); int i = 0; while (i < n) { - ne = myop(ne, x[i*4]); - y[i*4] = ne; + ne = myop(ne, x[i]); + y[i] = ne; i++; } \end{lstlisting} +\subsubsection{} + +\begin{lstlisting} +lw len, 0(x) // Loads the length of x from the first word in the list + +// dynalloc from group project +move regy, HP // Sets y to the start of the non-allocated memory +addi tmp, len, 3 // Adds 3 and rounds down, to line up with the 4-byte boundary +sra tmp, tmp, 2 +sll tmp, tmp, 2 +addi tmp, tmp, 4 // Adds space for the length of the array +add HP, HP, tmp // Moves HP +sw len, 0(regy) // Saves the length of the array in the first word + +addi i, R0, 0 // int i = 0 +loop_beg: + bge i, len, loop_end // while (i < n) {.. + add xi, x, i // x[i] + add yi, regy, i // y[i] + MIPS.CALL(myop, (ne, xi), ne) // ne = myop(ne, x[i]); + sw ne, 0(yi) // y[i] = ne; + addi i, i, 1 // i++; + j loop_beg +loop_end: + +\end{lstlisting} + + \newpage \appendix \section{Intermediate code generation}