Skip to content
Snippets Groups Projects
Commit 932e29d9 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Vortragsfolien und Beispiele 1.6.2021

parent e63fdf0c
Branches
No related tags found
No related merge requests found
#include <stdio.h>
int fak (int n)
{
int f = 1;
for (int i = 0; i < n; i++)
f *= i;
return f;
}
int main (void)
{
printf ("%d! = %d\n", 6, fak (6));
return 0;
}
#include <stdio.h>
int fak (int n)
{
int f = 1;
for (int i = 1; i < n; i++)
f *= i;
return f;
}
int main (void)
{
printf ("%d! = %d\n", 6, fak (6));
return 0;
}
#include <stdio.h>
int fak (int n)
{
int f = 1;
for (int i = 1; i <= n; i++)
f *= i;
return f;
}
int main (void)
{
printf ("%d! = %d\n", 6, fak (6));
return 0;
}
.file "fak-i-3.c"
.text
.globl fak
.type fak, @function
fak:
.LFB11:
.cfi_startproc
testl %edi, %edi
jle .L4 ; #include <stdio.h>
addl $1, %edi ;
movl $1, %edx ; int fak (int n)
movl $1, %eax ; {
.L3: ; int f = 1;
imull %edx, %eax ; for (int i = 1; i <= n; i++)
addl $1, %edx ; f *= i;
cmpl %edi, %edx ; return f;
jne .L3 ; }
ret
.L4:
movl $1, %eax
ret
.cfi_endproc
.LFE11:
.size fak, .-fak
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d! = %d\n"
.text
.globl main
.type main, @function
main:
.LFB12:
.cfi_startproc
subq $8, %rsp ; int main (void)
.cfi_def_cfa_offset 16 ; {
movl $6, %edi ; printf ("%d! = %d\n", 6, fak (6));
call fak ; return 0;
movl %eax, %edx ; }
movl $6, %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE12:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int fak (int n)
{
if (n <= 1)
return 1;
else
return n * fak (n - 1);
}
int main (void)
{
printf ("%d! = %d\n", 6, fak (6));
return 0;
}
File added
File added
% pgslides.sty - LaTeX Settings for Lecture Slides
% Copyright (C) 2012, 2013 Peter Gerwinski
%
% This document is free software: you can redistribute it and/or
% modify it either under the terms of the Creative Commons
% Attribution-ShareAlike 3.0 License, or under the terms of the
% GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% This document is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this document. If not, see <http://www.gnu.org/licenses/>.
%
% You should have received a copy of the Creative Commons
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
\usepackage{amsfonts}
\usepackage[british,german]{babel} % Yes, really "german" and not "ngerman".
\usepackage[utf8]{luainputenc} % Without this, umlauts are broken. Weird.
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{helvet}
\renewcommand*\familydefault{\sfdefault}
\usepackage{graphicx}
\usepackage{pstricks}
\hypersetup{colorlinks,allcolors=blue}
%% @@@ Not necessary for slides. Why???
%% Repair kerning: Automatically insert "\kern{-0.15em}" between "//" % (in URLs).
%\directlua{
% local glyph = node.id ("glyph")
% local function my_kerning (head)
% for t in node.traverse (head) do
% if t.id == glyph and t.char == 47 then
% if t.next
% and t.next.next
% and t.next.next.id == glyph
% and t.next.next.char == 47 then
% local k = node.new ("kern")
% k.kern = tex.sp ("-0.15em")
% k.next = t.next
% k.prev = t
% t.next.prev = k
% t.next = k
% end
% end
% end
% node.kerning (head)
% end
% luatexbase.add_to_callback ("kerning", my_kerning, "URL kerning")
%}
\usetheme{default}
\usefonttheme{structurebold}
\setbeamertemplate{navigation symbols}{}
\setbeamersize{text margin left = 0.3cm, text margin right = 0.2cm}
\setbeamertemplate{itemize item}{$\bullet$}
\setbeamertemplate{itemize subitem}{--}
\setbeamerfont{itemize/enumerate subbody}{size=\normalsize}
\setbeamerfont{itemize/enumerate subsubbody}{size=\normalsize}
\setbeamercolor{footline}{fg=gray}
\newcommand{\sep}{~$\cdot$~}
\newif\ifminimalistic
\minimalistictrue
\institute[Hochschule Bochum\sep CVH]{%
\makebox(0,0.005)[tl]{\includegraphics[scale=0.72]{logo-hochschule-bochum-cvh-text-v2.pdf}}\hfill
\makebox(0,0)[tr]{\includegraphics[scale=0.5]{logo-hochschule-bochum.pdf}}%
}
\setbeamertemplate{headline}{%
\leavevmode
\hbox to \textwidth{%
\ifminimalistic
\strut\hfill
\else
\rule{0pt}{5.7pt}%
\hspace*{8.55pt}\insertinstitute\hspace*{5.7pt}%
\raisebox{-30pt}{\rule{0pt}{1pt}}%
\fi
}%
\vskip0pt%
}
\iffalse
\setbeamertemplate{footline}{}
\else
\setbeamertemplate{footline}{%
\leavevmode
\hbox to \textwidth{%
\usebeamercolor{footline}%
\usebeamerfont{footline}%
\ifminimalistic
\strut\hfill
\else
\,\insertshorttitle\sep
\insertshortauthor\sep
\insertshortinstitute\sep
\insertshortdate\hfill
\fi
\insertframenumber/\inserttotalframenumber
%Folie\,\insertframenumber\sep Seite\,\insertpagenumber\,
}%
\vskip0pt%
}
\fi
\newcommand{\maketitleframe}{%
\ifminimalistic
\begin{frame}[t,plain]
\insertinstitute
\par\vfill
\begin{center}
{\LARGE\color{structure}\inserttitle\par}\bigskip\bigskip
{\large \insertauthor\par}\bigskip\medskip
\insertdate
\end{center}
\end{frame}
\else
\begin{frame}
\vfill
\begin{center}
{\LARGE\color{structure}\inserttitle\par}\bigskip\bigskip
{\large \insertauthor\par}\bigskip\medskip
\insertdate
\end{center}
\vfill
\end{frame}
\fi
}
\definecolor{medgreen}{rgb}{0.0,0.5,0.0}
\definecolor{darkgreen}{rgb}{0.0,0.3,0.0}
\definecolor{lightred}{rgb}{1.0,0.7,0.7}
\definecolor{medred}{rgb}{0.5,0.0,0.0}
\definecolor{bored}{rgb}{0.89,0.0,0.098}
\definecolor{lightgray}{rgb}{0.85,0.85,0.85}
\definecolor{orange}{rgb}{1.0,0.5,0.0}
\definecolor{darkgray}{rgb}{0.4,0.4,0.4}
\newenvironment{experts}{\color{darkgray}}{}
\usepackage{listings}
\lstset{basicstyle=\color{structure},
language=C,
captionpos=b,
gobble=4,
columns=fullflexible,
aboveskip=0pt,
belowskip=0pt,
moredelim=**[is][\color{structure}]{¡}{¿},
moredelim=**[is][\only<2->{\color{structure}}]{²}{¿},
moredelim=**[is][\only<3->{\color{structure}}]{³}{¿},
moredelim=**[is][\only<4->{\color{structure}}]{°}{¿},
moredelim=**[is][\only<5->{\color{structure}}]{¤}{¿},
moredelim=**[is][\only<6->{\color{structure}}]{¢}{¿},
moredelim=**[is][\only<7->{\color{structure}}]{æ}{¿},
moredelim=**[is][\only<8->{\color{structure}}]{ø}{¿}}
\lstdefinestyle{terminal}{basicstyle=\ttfamily\color{darkgreen},
language={},
columns=fixed,
moredelim=**[is][\color{red}]{¡}{¿},
moredelim=**[is][\color{blendedblue}]{°}{¿},
moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{²}{¿}}
\lstdefinestyle{cmd}{basicstyle=\ttfamily\color{red},
language={},
gobble=2,
columns=fixed,
moredelim=**[is][\color{darkgreen}]{¡}{¿},
moredelim=**[is][\color{structure}]{°}{¿},
moredelim=**[is][\sffamily\it\lstset{columns=fullflexible}]{²}{¿}}
\lstdefinestyle{shy}{basicstyle=\color{lightgray}}
\setcounter{topnumber}{3}
\renewcommand\topfraction{0.7}
\setcounter{bottomnumber}{3}
\renewcommand\bottomfraction{0.7}
\setcounter{totalnumber}{5}
\renewcommand\textfraction{0.1}
\renewcommand\floatpagefraction{0.9}
\setlength{\unitlength}{1cm}
\newcommand{\protectfile}[1]{#1}
\urlstyle{sf}
\newcommand{\file}[1]{{\color{structure}\protectfile{#1}}}
\newcommand{\textarrow}{{\boldmath $\longrightarrow$}}
\newcommand{\arrowitem}{\item[\textarrow]}
\newcommand{\newterm}[1]{\emph{\color{darkgreen}#1}}
\newcommand{\BIGskip}{\vspace{1cm}}
\newcommand{\shy}{\color{lightgray}}
\newcommand{\hot}{\color{red}}
\newcommand{\shyhot}{\color{lightred}}
\newcommand{\sectionnonumber}[1]{\section{#1}\addtocounter{section}{-1}}
\def\showsectionnonumber{\hbox{\Large\color{structure}\bf
\vtop{\secname}\par}\bigskip}
\newcommand{\nosectionnonumber}[1]{\gdef\nosectionnonumbername{#1}}
\def\shownosectionnonumber{\hbox{\Large\color{structure}\bf
\vtop{\nosectionnonumbername}\par}\bigskip}
\def\showsection{\hbox{\Large\color{structure}\bf
\vtop{\hbox{\arabic{section}}}\kern1em%
\vtop{\secname}\par}\bigskip}
\newcommand{\subsectionnonumber}[1]{\subsection{#1}\addtocounter{subsection}{-1}}
\def\showsubsectionnonumber{{\large\color{structure}\bf\subsecname\par}\bigskip}
\def\showsubsection{\hbox{\large\color{structure}\bf
\vtop{\hbox{\arabic{section}.\arabic{subsection}}}\kern1em%
\vtop{\subsecname}\par}\bigskip}
\newcommand{\subsubsectionnonumber}[1]{\subsubsection{#1}\addtocounter{subsubsection}{-1}}
\def\showsubsubsectionnonumber{{\normalsize\color{structure}\bf\subsubsecname\par}\bigskip}
\def\showsubsubsection{\hbox{\normalsize\color{structure}\bf
\vtop{\hbox{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}}\kern1em%
\vtop{\subsubsecname}\par}\bigskip}
File added
% rtech-20210601.pdf - Lecture Slides on Computer Technology
% Copyright (C) 2012, 2013, 2014, 2021 Peter Gerwinski
%
% This document is free software: you can redistribute it and/or
% modify it either under the terms of the Creative Commons
% Attribution-ShareAlike 3.0 License, or under the terms of the
% GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% This document is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this document. If not, see <http://www.gnu.org/licenses/>.
%
% You should have received a copy of the Creative Commons
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
% README: Architekturmerkmale von Prozessoren
\documentclass[10pt,t]{beamer}
\usepackage{pgslides}
\lstdefinestyle{asm}{basicstyle=\color{structure},
language={},
gobble=4}
\title{Rechnertechnik}
\author{Prof.\ Dr.\ rer.\ nat.\ Peter Gerwinski}
\date{1.\ Juni 2021}
\begin{document}
\maketitleframe
\sectionnonumber{\inserttitle}
\begin{frame}
\showsectionnonumber
\begin{itemize}
\item[\textbf{1}] \textbf{Einführung}
\item[\textbf{2}] \textbf{Vom Schaltkreis zum Computer}
\begin{itemize}
% \item[2.1] Logik-Schaltkreise
% \item[2.2] Binärdarstellung von Zahlen
% \item[2.3] Vom Logik-Schaltkreis zum Addierer
% \item[2.4] Negative Zahlen
% \item[2.5] Vom Addierer zum Computer
% \item[2.6] Computer-Sprachen
\item[\dots]
\item[2.7] Programmieren in Assembler
\color{medgreen}
\item[2.8] Struktur von Assembler-Programmen
\end{itemize}
\item[\textbf{3}] \textbf{Architekturmerkmale von Prozessoren}
\begin{itemize}
\color{medgreen}
\item[3.1] Speicherarchitekturen
\item[3.2] Registerarchitekturen
\item[3.3] Befehlssätze
\end{itemize}
\item[\textbf{4}] \textbf{Der CPU-Stack}
\begin{itemize}
\color{red}
\item[4.1] Implementation
\item[4.2] Unterprogramme
\item[4.3] Register sichern
\end{itemize}
\color{gray}
% \item[\textbf{5}] \textbf{Hardwarenahe Programmierung}
% \item[\textbf{6}] \textbf{Anwender-Software}
% \item[\textbf{7}] \textbf{Bus-Systeme}
% \item[\textbf{8}] \textbf{Pipelining}
\item[\textbf{\dots\hspace{-0.75em}}]
% \item[\textbf{9}] \textbf{Ausblick}
\end{itemize}
\end{frame}
\setcounter{section}{1}
\section{Vom Schaltkreis zum Computer}
\setcounter{subsection}{7}
\subsection{Struktur von Assembler-Programmen}
\begin{frame}[fragile]
\showsubsection
Selbstmodifizierender Code
Beispiel: Selbsterkennung von "`Fini"'
\begin{minipage}[t]{1.2cm}
\begin{lstlisting}[language={},gobble=6]
num
start
pos
\end{lstlisting}
\end{minipage}%
\begin{minipage}[t]{0.9cm}
\begin{lstlisting}[language={},gobble=6]
dat #-2
mov num, <pos
jmp start
dat
end start
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}[t]{3.9cm}
\small
\bigskip
Instruktionen:\\[\smallskipamount]
\lstinline{dat B}\\
\lstinline{mov A, B}\\
\lstinline{add A, B}\\
\lstinline{sub A, B}\\
\lstinline{jmp A}\\
\lstinline{jmz A, B} -- "`jump if zero"'\\
\lstinline{jmn A, B} -- "`if not zero"'\\
\lstinline{djn A, B} -- "`dec. \& jmn"'\\
\lstinline{cmp A, B} -- vgl.\ \& überspr.\\
\lstinline{spl A} -- verzweigen
\end{minipage}%
\begin{minipage}[t]{2.7cm}
\small
\bigskip
Adressierungsarten:\\[\medskipamount]
grundsätzlich:\\
Speicher relativ\\[\medskipamount]
\lstinline{#} -- unmittelbar\\[\smallskipamount]
\lstinline{$} -- direkt\\[\smallskipamount]
\lstinline{@} -- indirekt\\[\smallskipamount]
\lstinline{<} -- indirekt mit\\
\hspace*{0.52cm}Prä-Decrement
\end{minipage}
\end{frame}
\begin{frame}[fragile]
\showsubsection
\strut
\strut\makebox(0,0)[bl]{\large\color{structure}\textbf{Ehemaliger Praktikumsversuch (2014)}}
\hfill Inspiration für Projekt?
\begin{minipage}[t]{5cm}
\medskip
Schreiben Sie ein\\
Redcode-Programm,\\
das die Gegner\\
\file{Nothing}, \file{Knirps}\\
und \file{Mice} besiegt.
\medskip
ICWS-88-Standard,\\
max.\ 64 Prozesse,\\
Speichergröße zufällig
\medskip
Teams bis zu 3 Personen\\
sind zulässig.
\end{minipage}\hfill
\begin{minipage}[t]{3.9cm}
\small
\bigskip
Instruktionen:\\[\smallskipamount]
\lstinline{dat B}\\
\lstinline{mov A, B}\\
\lstinline{add A, B}\\
\lstinline{sub A, B}\\
\lstinline{jmp A}\\
\lstinline{jmz A, B} -- "`jump if zero"'\\
\lstinline{jmn A, B} -- "`if not zero"'\\
\lstinline{djn A, B} -- "`dec. \& jmn"'\\
\lstinline{cmp A, B} -- vgl.\ \& überspr.\\
\lstinline{spl A} -- verzweigen
\end{minipage}%
\begin{minipage}[t]{2.7cm}
\small
\bigskip
Adressierungsarten:\\[\medskipamount]
grundsätzlich:\\
Speicher relativ\\[\medskipamount]
\lstinline{#} -- unmittelbar\\[\smallskipamount]
\lstinline{$} -- direkt\\[\smallskipamount]
\lstinline{@} -- indirekt\\[\smallskipamount]
\lstinline{<} -- indirekt mit\\
\hspace*{0.52cm}Prä-Decrement
\end{minipage}
\end{frame}
\section{Architekturmerkmale von Prozessoren}
\subsection{Speicherarchitekturen}
\begin{frame}
\showsection
\showsubsection
Bezeichnungen
\begin{itemize}
\item
\newterm{Bit\/} = 0 oder 1 -- kleinste Einheit an Information
\item
\newterm{Byte\/} = Zusammenfassung mehrerer \newterm{Bits}\\
zu einer Binärzahl, die ein Zeichen (\newterm{Character\/}) darstellen kann,\\
häufig 8 Bits (\newterm{Oktett\/})
\item
\newterm{Speicherwort\/} = Zusammenfassung mehrerer Bits\\
zu der kleinsten adressierbaren Einheit, häufig 1 Byte
\item
\newterm{RAM\/} = \newterm{Random Access Memory\/} = Hauptspeicher
\item
\newterm{ROM\/} = \newterm{Read Only Memory\/} = nur lesbarer Speicher
\end{itemize}
\end{frame}
\begin{frame}
\showsubsection
Verschiedene Arten von Speicher
\begin{itemize}
\item
\newterm{Prozessor-Register}\\
können direkt mit ALU verbunden werden,\\
besonders schnell (Flipflops),\\
überschaubare Anzahl von Registern
\item
\newterm{Hauptspeicher}\\
kann direkt adressisert und mit Prozessor-Registern abgeglichen werden,\\
heute i.\,d.\,R.\ dynamischer Speicher (Kondensatoren)
\item
\newterm{I/O-Ports}\\
sind spezielle Speicheradressen, über die\\
mit externen Geräten kommuniziert wird
\item
\newterm{Massenspeicher}\\
liegt auf externem Gerät, wird über I/O-Ports angesprochen,\\
Festplatte, Flash-Speicher, \dots
\end{itemize}
\end{frame}
\begin{frame}
\showsubsection
\begin{itemize}
\item
\newterm{Von-Neumann-Architektur}\\
Es gibt nur 1 Hauptspeicher, in dem sich sowohl die Befehle\\
als auch die Daten befinden.
\begin{onlyenv}<1>
Vorteil: Flexibilität in der Speichernutzung
Nachteil: Befehle können überschrieben werden.\\
$\longrightarrow$ Abstürze und Malware möglich
\end{onlyenv}
\pause
\item
\newterm{Harvard-Architektur}\\
Es gibt 2 Hauptspeicher. In einem befinden sich die Befehle,\\
im anderen die Daten.
\begin{onlyenv}<2>
Vorteil: Befehle können nicht überschrieben werden\\
$\longrightarrow$ sicherer als Von-Neumann-Architektur
Nachteile: Leitungen zum Speicher (Bus) müssen doppelt vorhanden sein,\\
freier Befehlsspeicher kann nicht für Daten genutzt werden.
\end{onlyenv}
\pause
\item
Weitere Kombinationen\\
Hauptspeicher und I/O-Ports gemeinsam oder getrennt,\\
Hauptspeicher und Prozessorregister gemeinsam oder getrennt
\end{itemize}
\end{frame}
\begin{frame}
\showsubsection
Beispiele:
\begin{itemize}
\item
Intel IA-32 (i386, Nachfolger und Kompatible):\\
Von-Neumann-Architektur (plus Speicherschutzmechanismen),\\
Prozessorregister und I/O-Ports vom Hauptspeicher getrennt
\item
Atmel AVR (z.\,B.\ ATmega):\\
Harvard-Architektur (Befehlsspeicher als Flash-Speicher grundsätzlich auch schreibbar),\\
Prozessorregister und I/O-Ports in gemeinsamem Adressbereich mit Hauptspeicher
\item
6502 (heute: Renesas-Mikro-Controller):\\
Von-Neumann-Architektur,\\
I/O-Ports in gemeinsamem Adressbereich mit Hauptspeicher,\\
Prozessorregister und Hauptspeicher getrennt
\end{itemize}
\end{frame}
\subsection{Registerarchitekturen}
\begin{frame}[fragile]
\showsubsection
\vspace*{-\medskipamount}
\begin{itemize}
\item
Mehrere Register, einzeln ansprechbar
\item
\newterm{Akkumulator\/}: Nur 1 Register kann rechnen.
\item
\newterm{Stack-Architektur\/}: Stapel, "`umgekehrte Polnische Notation"'
\end{itemize}
\pause
Operationen: typischerweise nur
\lstinline{=}, \lstinline{+=}, \lstinline{-=}, \lstinline{*=}, \lstinline{/=}, \dots
\pause
\medskip
Beispiel: \lstinline{c = a + 2 * b;}
\pause
\medskip
\begin{minipage}[t]{2cm}
C:\smallskip\par
\begin{lstlisting}[gobble=6]
R = b;
R *= 2;
R += a;
c = R;
\end{lstlisting}
\end{minipage}\pause
\begin{minipage}[t]{4cm}
Mehrere Register:\smallskip\par
\begin{lstlisting}[style=asm,gobble=6]
movl (b), %eax
imull $2, %eax, %eax
addl (a), %eax
movl %eax, (c)
\end{lstlisting}
\smallskip\par
(IA-32-Assembler)
\end{minipage}\pause
\begin{minipage}[t]{3cm}
Akkumulator:\smallskip\par
\begin{lstlisting}[style=asm,gobble=6]
load (b)
mul $2
add (a)
store (c)
\end{lstlisting}
\smallskip\par
(Pseudo-Assembler)
\end{minipage}\pause
\begin{minipage}[t]{3cm}
Register-Stack:\smallskip\par
\begin{lstlisting}[style=asm,gobble=6]
push (a)
push (b)
push $2
mul
add
pop (c)
\end{lstlisting}
\end{minipage}
\end{frame}
\begin{frame}
\showsubsection
Beispiele:
\begin{itemize}
\item
Intel IA-32 (i386, Nachfolger und Kompatible):\\
Mehrere Register, für verschiedene Zwecke spezialisiert (unübersichtlich),\\[\smallskipamount]
Fließkommaregister: Stack-Architektur
\item
Atmel AVR (z.\,B.\ ATmega):\\
32 Register
\item
6502 (heute: Renesas-Mikro-Controller):\\
3 Register: A, X, Y. Nur A kann rechnen $\longrightarrow$ Akkumulator
\item
Java Virtual Machine (JVM):\\
Stack-Architektur
\item
Redcode:\\
Jede Speicherzelle fungiert als Register
\end{itemize}
\end{frame}
\subsection{Befehlssätze}
\begin{frame}
\showsubsection
\begin{itemize}
\item
\newterm{Complex Instruction Set Computer (CISC)}
\smallskip
Umfangreiche Befehlssätze, mächtige Befehle
\begin{onlyenv}<1>
\textarrow\ komfortable manuelle Programmierung in Assembler\\
\textarrow\ längere Abarbeitungszeit der einzelnen Befehle
\smallskip
Realisierung: "`Prozessor im Prozessor"' -- \newterm{Mikroprogramme}
\smallskip
Beispiele: IA-32, AMD-64
\end{onlyenv}
\medskip
\pause
\item
\newterm{Reduced Instruction Set Computer (RISC)}
\smallskip
wenige, wenig mächtige Befehle
\begin{onlyenv}<2>
\textarrow\ Programmierung in Assembler für Menschen unkomfortabel\\
\textarrow\ schnelle Abarbeitung der Befehle
\smallskip
Beispiele: Atmel AVR, Redcode
\end{onlyenv}
\pause
\medskip
\item
\newterm{Very Long Instruction Word (VLIW)\/} und\\
\newterm{Explicitly Parallel Instruction Computing (EPIC)}
\smallskip
mehrere Befehle gleichzeitig ausführbar
\begin{onlyenv}<3>
\textarrow\ mehr Rechenleistung möglich\\
\textarrow\ Programmierung sehr aufwendig
\smallskip
Beispiel: IA-64
\end{onlyenv}
\pause
\medskip
\item
\newterm{Orthogonaler Befehlssatz}
\smallskip
jeder Befehl mit jeder Adressierungsart kombinierbar
\end{itemize}
\end{frame}
\section{Der CPU-Stack\label{CPU-Stack}}
\subsection{Implementation}
\begin{frame}
\showsection
\showsubsection
Speicher, in dem Werte "`gestapelt"' werden: \newterm{Stack}
\begin{itemize}
\item
Speicherbereich (ein array) reservieren
\item
Variable (typischerweise: Prozessorregister) als
\newterm{Stack Pointer\/} reservieren \textarrow\ \lstinline{SP}
\item
Assembler-Befehl \lstinline[style=asm]{push foo}: \quad
\lstinline{*SP++ = foo;}
\item
Assembler-Befehl \lstinline[style=asm]{pop bar}: \quad
\lstinline{bar = *--SP;}
\end{itemize}
\pause
\medskip
Speziell: Unterprogramme
\end{frame}
\subsection{Unterprogramme}
\begin{frame}[fragile]
\showsection
\showsubsection
\begin{minipage}[t]{4.5cm}
Parameter:
\begin{itemize}
\item
Prozessorregister
\item
CPU-Stack
\end{itemize}
\smallskip
Rückgabewert:
\begin{itemize}
\item
Prozessorregister
\end{itemize}
\end{minipage}%
\begin{minipage}[t]{5cm}
Aufruf:
\begin{itemize}
\item
\lstinline[style=asm]{push IP}\\
\lstinline[style=asm]{jmp foo}
{\color{red}\boldmath $\longleftarrow$ mov \#foo IP}\\
\textarrow\ \lstinline[style=asm]{call foo}
\end{itemize}
Rücksprung:
\begin{itemize}
\item
\lstinline[style=asm]{pop IP}\\
\textarrow\ \lstinline[style=asm]{ret}
\end{itemize}
\end{minipage}
\end{frame}
\subsection{Register sichern}
\begin{frame}
\showsection
\showsubsection
Ein Unterprogramm verändert Registerinhalte.
\begin{itemize}
\item
im Hauptprogramm nötigenfalls vor Aufruf sichern
\item
im Unterprogramm vor Benutzung sichern
\item
Kombinationen (manche Register so, manche so)
\end{itemize}
\end{frame}
\end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment