report.tex 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. \documentclass[a4paper,12pt]{article}
  2. \usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
  3. \usepackage[T1]{fontenc}
  4. \usepackage[utf8]{inputenc}
  5. \usepackage{newunicodechar}
  6. \usepackage{lmodern}
  7. \usepackage{textgreek}
  8. \usepackage{amsmath}
  9. \usepackage{mathtools}
  10. \usepackage{graphicx}
  11. \usepackage{pdflscape}
  12. \usepackage{svg}
  13. \usepackage{tabularx}
  14. \usepackage{blindtext}
  15. \usepackage{hyperref}
  16. \usepackage{pgfgantt}
  17. \usepackage{colortbl}
  18. \usepackage{pdfpages}
  19. \usepackage{setspace}
  20. \usepackage{subcaption}
  21. \usepackage{tikz}
  22. \usepackage{chngcntr}
  23. \usepackage{longtable}
  24. \usepackage{xcolor,colortbl}
  25. \usepackage{pdfpages}
  26. \counterwithin{figure}{subsection}
  27. \usepackage{multicol}
  28. \setcounter{tocdepth}{3}
  29. \usepackage[backend=bibtex]{biblatex}
  30. \addbibresource{references.bib}
  31. \begin{document}
  32. \begin{titlepage}
  33. \newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
  34. \begin{tikzpicture}[remember picture, overlay]
  35. \node [anchor=north east, inner sep=0pt] at (current page.north east)
  36. {\includegraphics[width=21cm]{graphics/ucl-banner-dl-port-outline.eps}};
  37. \end{tikzpicture}\\[3cm]
  38. \center
  39. \textsc{\Large University College London}\\[0.5cm]
  40. \textsc{\large Department of Electronic and Electrical Engineering}\\[0.5cm]
  41. \HRule \\[0.4cm]
  42. \setstretch{1.5}
  43. { \huge \bfseries Performance characterisation of 8-bit RISC and OISC architectures}\\[0.4cm]
  44. \setstretch{1.0}
  45. \HRule \\[1.0cm]
  46. \begin{multicols}{3}
  47. \Large \emph{Author:}\\
  48. Mindaugas \textsc{Jarmolovicius}\\
  49. \href{mailto:zceemja@ucl.ac.uk}{zceemja@ucl.ac.uk}\\
  50. \columnbreak
  51. \Large \emph{Supervisor:}\\
  52. Prof. Robert \textsc{Killey}\\
  53. \href{mailto:r.killey@ucl.ac.uk}{r.killey@ucl.ac.uk}
  54. \columnbreak
  55. \Large \emph{Second Assessor:}\\
  56. Dr. Ed \\\textsc{Romans}\\
  57. \href{mailto:e.romans@ucl.ac.uk}{e.romans@ucl.ac.uk}
  58. \end{multicols}
  59. \vfill
  60. \setstretch{2.5}
  61. { \large \bfseries A BEng Project Interim Report}\\[1cm]
  62. \setstretch{1.0}
  63. {\large December 13, 2019}\\[2cm]
  64. \end{titlepage}
  65. \pagebreak
  66. \begin{multicols}{2}
  67. \section{Abstract}
  68. This is abstract.
  69. \section{Introduction}
  70. Since 80s there been a raise of many processor architectures that try to fulfil specific performance and power application constraints. One of noticeable cases is ARM RISC (Reduced Instruction Set Computer) architecture being used in mobile devices instead of more popular and robust x86 CISC (Complex Instruction Set Computer) architecture in favour of simplicity, cost and lower power consumption \autocite{jamil_1995,blem_menon_sankaralingam_2013}. Its been shown that in low power applications such as IoTs (Internet of Things), OISC\footnote{Also known as URISC (Ultimate Reduced Instruction Set Computer)} (One Instruction Set Computer) implementation can be superior in power and data throughput comparing to traditional RISC architectures \autocite{yokota_saso_hara-azumi_2017, ahmed_sakamoto_anderson_hara-azumi_2015}. This project proposes to compare two novel RISC and OISC architectures and compare their performance, design complexity and efficiency.
  71. Project is split into 3 main objectives:\\
  72. $\bullet$ Design and build a RISC based processor. As it is aimed for low power and performance applications this will be 8bit data size processor with 4 general purpose registers.\\
  73. $\bullet$ Design and build an OISC based processor. There are multiple different implementations such as \texttt{SUBLEQ} or one proposed in chapter \ref{sec:theory}.\\
  74. $\bullet$ Design a fair benchmark that both processors could execute. Benchmark may include different algorithms that are commonly used in controllers, IoT devices or similar low power microprocessor applications.
  75. Following chapters will describe the estimated project outcome, project schedule and work done so far.
  76. \section{The Work Performed to Date}
  77. \subsection{Supporting Theory} \label{sec:theory}
  78. This section explains the theory and predictions of RISC and OISC architectures.
  79. Figure \ref{fig:simple_blocks} represents simplified diagrams of RISC and OISC architectures. In RISC architecture, program data travels from program memory to control block where instruction is decoded and further decided where what data is directed. Such structure requires complicated control block and additional data routing blocks. In order to increase performance of such processor one would need to add pipelining or add multiple cores. Both methods bring big disadvantages - multicore processor requires software adjustments and each core doubles the control and datapath substantially increasing die area; pipelinig allow operation at higher frequencies however it brings design complications such as complicated hazard prevention logic and instruction lookup. Simplicity of OISC architecture overcomes these disadvantages by following:
  80. Pipelining can be done by individual blocks and programmibly waiting for results, multicore can be simulated by adding more data and instruction buses, hazards can be prevented with software or/and integrated into address registers.
  81. Furthermore, ALU and any other processor component can be divided by adding different address registers thus allowing to utilise multiple components at the same time given that multiple data buses are used.
  82. \begin{figure*}[h!]
  83. \centering
  84. \begin{subfigure}[b]{1\textwidth}
  85. \includegraphics[width=\linewidth]{graphics/risc.eps}
  86. \caption{RISC microarchitecture diagram}
  87. \label{fig:risc_simple}
  88. \end{subfigure}
  89. \begin{subfigure}[b]{1\textwidth}
  90. \includegraphics[width=\linewidth]{graphics/oisc.eps}
  91. \caption{Single data bus OISC microarchitecture diagram}
  92. \label{fig:oisc_simple}
  93. \end{subfigure}
  94. \caption{Simplified diagrams of both architectures. Blue lines indicate control/instruction buses and black - data buses}
  95. \label{fig:simple_blocks}
  96. \end{figure*}
  97. \end{multicols}
  98. \newpage
  99. \begin{landscape}
  100. \subsection{Project Scheduling}
  101. As it can be seen in table \ref{table:time} below, project is mainly split into Term 1 which is dedicated for RISC and Term 2 which is dedicated for OISC implementation. Approximately 3 weeks are left until final report to have enough spare time to finish all tests and complete poster \& report itself. It is also expected to have a lot of coursework around this time.
  102. \begin{table}[h!]
  103. \centering
  104. \begin{ganttchart}[
  105. y unit title=0.4cm,
  106. y unit chart=0.5cm,
  107. x unit=1.1mm,
  108. hgrid,
  109. today=2019-12-13,
  110. today label node/.append style={below=12pt},
  111. today label font=\itshape\color{blue},
  112. today rule/.style={draw=blue, ultra thick},
  113. title height=1,
  114. bar/.append style={fill=blue!50},
  115. bar incomplete/.append style={fill=gray!50},
  116. progress label text={$\displaystyle{#1\%}$},
  117. time slot format=isodate
  118. ]{2019-10-01}{2020-03-31}
  119. \gantttitlecalendar{year, month=shortname} \\
  120. \gantttitle{40}{6}
  121. \gantttitlelist{41,...,52}{7}
  122. \gantttitlelist{1,...,13}{7}
  123. \gantttitle{}{2} \\
  124. \ganttbar[progress=100]{RISC implementation}{2019-10-01}{2019-10-27}\\
  125. \ganttbar[progress=90]{RISC Optimisations}{2019-10-27}{2019-11-25}\\
  126. \ganttbar[progress=100]{UART and I/O}{2019-10-21}{2019-10-27}
  127. \ganttbar[progress=100]{}{2019-11-25}{2019-12-08} \\
  128. \ganttbar[progress=100]{RISC Assembler}{2019-10-14}{2019-11-11}\\
  129. \ganttbar[progress=20]{Developing benchmark}{2019-11-11}{2019-12-13}
  130. \ganttbar[progress=0]{}{2020-02-23}{2020-03-07} \\
  131. \ganttbar[progress=10]{OISC Implementation}{2019-12-02}{2019-12-13}
  132. \ganttbar[progress=0]{}{2020-01-13}{2020-02-02}\\
  133. \ganttbar[progress=0]{OISC Optimisations}{2020-02-02}{2020-02-23}\\
  134. \ganttbar[progress=0]{OISC Assembler}{2020-01-20}{2020-02-09}\\
  135. \ganttbar[progress=0]{OISC Compiler}{2020-02-09}{2020-03-01}\\
  136. \ganttmilestone{Project Proposal finalised}{2019-10-14}\\
  137. \ganttmilestone{Progress Report \#1}{2019-11-04}\\
  138. \ganttmilestone{Progress Report \#2}{2019-11-25}\\
  139. \ganttmilestone{December Interim Report}{2019-12-13}\\
  140. \ganttmilestone{Progress Report \#3}{2020-01-20}\\
  141. \ganttmilestone{Progress Report \#4}{2020-02-14}\\
  142. \ganttmilestone{Progress Report \#5}{2020-03-02}\\
  143. \ganttmilestone{Poster Presentation}{2020-03-18}\\
  144. \ganttmilestone{Final Report}{2020-03-30}\\
  145. \ganttvrule{Reading Week}{2019-11-03}
  146. \ganttvrule{}{2019-11-10}
  147. \ganttvrule[vrule label node/.append style={anchor=north west}]{Holidays}{2019-12-13}
  148. \ganttvrule{}{2020-01-12}
  149. \ganttvrule{Reading Week}{2020-02-17}
  150. \ganttvrule{}{2020-02-23}
  151. \end{ganttchart}
  152. \caption{Project schedule Grantt chart}
  153. \label{table:time}
  154. \end{table}
  155. \end{landscape}
  156. \pagebreak
  157. \begin{multicols}{2}
  158. \subsection{Progress to Date}
  159. Use as many sections as you need to in order to discuss your progress so far. For example, you can use a different section to discuss each bit of the system to be constructed or designed.Include difficulties and issues impeding progress.
  160. \subsubsection{Memory}
  161. Initial plan was to use 32M-Word 16bit SDRAM chip located at FPGA board. After successfully simulating most of processor functions, next step was to synthesise and run it on FPGA which brought 2 problems: (1) Uploading program into ROM is not simple as generic Verilog unpacked register array cannot be initialised from file. Solution to this problem was solved by using FPGA built-in M9K memory that allows flexible RAM/ROM configuration. In addition, M9K memory can be read from/written to via JTAG connection without affecting FPGA operation which enabled quick method to upload programs without need to resynthesising processor code.
  162. (2) Timing of SDRAM memory controller runs at much higher frequency than processor (at 100MHz versus 1MHz), initial implementation of interface between them was multiple 1-word length FIFO registers which caused memory read operation take 2 processor cycles. 3 possible solutions were considered - suspend processor clock while memory data is read which would harm performance; remove FIFO registers and rely on SDRAM clock being much greater than processor clock which is not ideal if higher processor clocks are intended to be used; use M9K. Last option was chosen due to ease of implementation and ability to read RAM content via JTAG for debugging purposes.
  163. \end{multicols}
  164. \newpage
  165. \subsubsection{Instructions}
  166. Table \ref{table:risc_instr} below represents RISC processor instructions that been implemented so far.
  167. \arrayrulecolor{black}
  168. \begin{longtable}{| l | p{.70\textwidth} | c |}
  169. \hline
  170. \rowcolor[rgb]{0.82,0.82,0.82}
  171. Instr. & Description & Completed \\\hline
  172. \multicolumn{3}{|c|}{
  173. \cellcolor[rgb]{0.7,0.7,1}\textit{2 register instructions}} \\\hline
  174. \arrayrulecolor[rgb]{0.82,0.82,0.82}
  175. MOVE & Copy intimidate or register & x \\\hline
  176. ADD & Arithmetical addition & x \\
  177. SUB & Arithmetical subtraction & x \\
  178. AND & Logical AND & x \\
  179. OR & Logical OR & x \\
  180. XOR & Logical XOR & x \\
  181. MUL & Arithmetical multiplication & x \\
  182. DIV & Arithmetical division (inc. modulus) & x \\
  183. \arrayrulecolor{black}\hline
  184. \multicolumn{3}{|c|}{
  185. \cellcolor[rgb]{0.7,0.7,1}\textit{1 register instructions}} \\
  186. \hline\arrayrulecolor[rgb]{0.82,0.82,0.82}
  187. CI0 & Replace intimidate value byte 0 for next instruction & x \\
  188. CI1 & Replace intimidate value byte 1 for next instruction & x \\
  189. CI2 & Replace intimidate value byte 2 for next instruction & x \\\hline
  190. SLL & Shift left logical & \\
  191. SRL & Shift right logical & \\
  192. SRA & Shift right arithmetical & \\\hline
  193. LWHI & Load word (high byte) & x \\
  194. SWHI & Store word (high byte, reg. only) & x \\
  195. LWLO & Load word (low byte) & x \\
  196. SWLO & Store word (low byte, stores high byte reg.) & x \\\hline
  197. INC & Increase by 1 & x \\
  198. DEC & Decrease by 1 & x \\
  199. GETAH& Get ALU high byte reg. (only for MUL \& DIV) & x \\
  200. GETIF& Get interrupt flags & x \\\hline
  201. PUSH & Push to stack & x \\
  202. POP & Pop from stack & x \\
  203. COM & Send/Receive to/from com. block & x \\\hline
  204. ADDI & Arithmetical addition with intimidate & x \\
  205. SUBI & Arithmetical subtraction with intimidate & x \\
  206. ANDI & Logical AND with intimidate & x \\
  207. ORI & Logical OR with intimidate & x \\
  208. XORI & Logical XOR with intimidate & x \\\hline
  209. BEQ & Branch on equal & x \\
  210. BGT & Branch on greater than & x \\
  211. BGE & Branch on greater equal than & x \\
  212. BZ & Branch on zero & x \\
  213. \arrayrulecolor{black}\hline
  214. \multicolumn{3}{|c|}{
  215. \cellcolor[rgb]{0.7,0.7,1}\textit{0 register instructions}
  216. } \\
  217. \hline\arrayrulecolor[rgb]{0.82,0.82,0.82}
  218. CALL & Call function, put return to stack & x \\
  219. RET & Return from function & x \\
  220. JUMP & Jump to address & x \\
  221. RJUMP& Relative jump & \\\hline
  222. RETI & Return from interrupt & x \\
  223. INTRE& Set interrupt entry pointer & x \\\hline
  224. CLC & Clear ALU carry-in & \\
  225. SETC & Set ALU carry-in & \\
  226. CLS & Clear ALU sign & \\
  227. SETS & Set ALU sign & \\
  228. SSETS& Enable ALU sign & \\
  229. CLN & Clear ALU negative & \\
  230. SETN & Set ALU negative & \\
  231. SSETN& Enable ALU negative & \\
  232. \arrayrulecolor{black}\hline
  233. \caption{Instruction set for RISC processor}
  234. \label{table:risc_instr}
  235. \end{longtable}
  236. \subsubsection{Program Counter}
  237. \begin{figure*}[h!]
  238. \centering
  239. %\def\svgwidth{16cm}
  240. \includegraphics[width=\linewidth]{graphics/program_counter.eps}
  241. \caption{Digital diagram of RISC8 program counter}
  242. \label{fig:program_counter}
  243. \end{figure*}
  244. \subsubsection{Stack Pointer}
  245. \begin{figure*}
  246. \centering
  247. \includegraphics[width=\linewidth]{graphics/stack_diagram.eps}
  248. \caption{Digital diagram of RISC8 program counter}
  249. \label{fig:stack_pointer}
  250. \end{figure*}
  251. \section{Summary of Difficulties and Issues}
  252. \begin{multicols}{2}
  253. This chapter focuses on any difficulties and issues that are hindering project from moving forward.
  254. \subsection{List of Difficulties}
  255. List of difficulties currently encounter:
  256. \begin{description}
  257. \item[$\bullet$] Benchmark
  258. \item[$\bullet$] Assembler/Compiler
  259. \end{description}
  260. \subsubsection{Benchmark}
  261. One of the difficulties is to design an appropriate benchmark that could test scenarios used in actual such processor applications. Other issue comes with writing benchmark itself, for instance benchmark test to finding prime number may have used many different algorithms where one of the fastest and used in actual industry may be "Sieve of Atkin" algorithm \autocite{morain_1989}, however is it fairly complicated and time consuming especially when written in assembly.
  262. \subsubsection{Assembler/Compiler}
  263. In order to write more complicated code for benchmark, a proper compiler is required. Current assembler support definitions and labels, however not macros or imports from other files, nor linked libraries. Ideally, a common language compiler needs to be developed so that benchmark programs could be imported without need to completely rewrite them in assembly. However such compiler might take more time to develop than writing benchmarks in assembly. Therefore it needs to be decided which option to do.
  264. \subsection{Failure Assessment}
  265. This section describes likely possibilities of project failures:
  266. As of current schedule OISC processor will be implemented in Term 2, however due to personal schedule project will be given about twice less time than in Term 1 which may result in not finishing OISC processor or developing all benchmarks for it on time. Mitigation for this is to closely follow schedule and adjust OISC design in such way as it would take less time to implement benchmark.
  267. Another possibility may be FPGA failure which would delay testing and benchmarking processors.
  268. \subsection{Updated Safety Risk Assessment}
  269. There are no changes to Safety Risk Assessment.
  270. \end{multicols}
  271. \section{Appendix A: Safety Risk Assessment}
  272. RiskNet report is appended at the end of this document.
  273. \section{Appendix B: Computer Code}
  274. Append any code you may need here. Reference it in the text as "Appendix B, code snippet \#"; for example,"Finda sample of the code usedfor this experiment in Appendix B, code snippet 2".
  275. \section{References}
  276. \printbibliography
  277. \includepdf[pages=-]{risknet.pdf}
  278. \end{document}