Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita3a3096

Browse files
committed
HW2 - objective 4 - part a - 90%
1 parent2a16ee8 commita3a3096

File tree

2 files changed

+122
-1
lines changed

2 files changed

+122
-1
lines changed

‎homework2/homework2.pdf‎

7.51 KB
Binary file not shown.

‎homework2/homework2.tex‎

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,128 @@ \subsection{(a)}
414414

415415
Následne po správnej inicializácii registra sme schopný vykonávať jednotlivé činnosti$TS$$M$ pomocou určitých podprogramov. Samotný podprogram reprezentuje rutinu ktorá sa správa rovnako ako chovanie jednej činnosti$TS$$M$.\\
416416

417-
\red{\textbf{TODO}}: jednotlivé rutiny pre TS
417+
Rutiny pre jednotlivé činnosti $TS$ $M$ môžeme rozdeliť na základe ich závislosti na posuvné, zápisové a overovacie. Posuvné realizujú posuv hlavy zo symbolu na symbol ktoré ale nekontrolujú \green{\textit{EOT}} pretože prechod $TS$ $M$ závisí od aktuálneho symbolu pod hlavou, ktorý sa kontroluje zda to nie je \green{\textit{EOT}} v overovacích rutinách, ktoré realizujú čítanie symbolu pod hlavou. Každá posuvná a zápisová rutina je podmienená overovacou rutinou, ktorá vždy overí zda sa tam nenachádza \green{\textit{EOT}}. Každá overovacia rutina obsahuje na začiatku kód pre overenie \green{\textit{EOT}} pod ktorým sa nachádza kód pre overenie $0$,$1$ alebo $\Delta$. Ak overovacia rutina odhalí \green{\textit{EOT}} tak beh programu je ukončený s návratovou hodnotou $0$, ak neodhalí \green{\textit{EOT}} symbol tak overí zda sa jedná o očakávaný symbol a ak sa jedná o očakávaný symbol tak sa vykoná posuvná alebo zápisová rutina. Overovacie rutiny obsahujú na konci \texttt{NOOP;} ktorý je možný realizovať za pomoci dvoch príkazov \texttt{x /= 2; x *= 2;} ktoré realizujú neutrálnu operáciu. Je to z toho dôvodu, že bolo potrebné pre overovaciu rutinu vytvoriť koncovú návesť.\\
418+
419+
Posuvné rutiny:
420+
\begin{itemize}
421+
\item Posun hlavny do ľava
422+
\begin{flushright}
423+
\begin{minipage}{0.90\textwidth}
424+
\begin{tabular}{r|l}
425+
\textit{A} &\texttt{x *= 2;}\\
426+
\textit{B} &\texttt{x *= 2;}
427+
\end{tabular}
428+
\end{minipage}
429+
\end{flushright}
430+
\item Posun hlavy do prava
431+
\begin{flushright}
432+
\begin{minipage}{0.90\textwidth}
433+
\begin{tabular}{r|l}
434+
\textit{A} &\texttt{x /= 2;}\\
435+
\textit{B} &\texttt{x /= 2;}
436+
\end{tabular}
437+
\end{minipage}
438+
\end{flushright}
439+
\end{itemize}
440+
441+
Zápisové rutiny:
442+
\begin{itemize}
443+
\item Zápis symbolu$1$
444+
\begin{flushright}
445+
\begin{minipage}{0.90\textwidth}
446+
\begin{tabular}{r|l}
447+
\textit{A} &\texttt{x /= 2;}\\
448+
\textit{B} &\texttt{odd(x);}\\
449+
\textit{C} &\texttt{x *= 2;}\\
450+
\textit{D} &\texttt{odd(x);}
451+
\end{tabular}
452+
\end{minipage}
453+
\end{flushright}
454+
\item Zápis symbolu$0$
455+
\begin{flushright}
456+
\begin{minipage}{0.90\textwidth}
457+
\begin{tabular}{r|l}
458+
\textit{A} &\texttt{x /= 2;}\\
459+
\textit{B} &\texttt{odd(x);}\\
460+
\textit{C} &\texttt{x *= 2;}\\
461+
\textit{D} &\texttt{even(x);}
462+
\end{tabular}
463+
\end{minipage}
464+
\end{flushright}
465+
\item Zápis symbolu$\Delta$
466+
\begin{flushright}
467+
\begin{minipage}{0.90\textwidth}
468+
\begin{tabular}{r|l}
469+
\textit{A} &\texttt{x /= 2;}\\
470+
\textit{B} &\texttt{even(x);}\\
471+
\textit{C} &\texttt{x *= 2;}\\
472+
\textit{D} &\texttt{even(x);}
473+
\end{tabular}
474+
\end{minipage}
475+
\end{flushright}
476+
\end{itemize}
477+
478+
\newpage
479+
480+
Overovacie rutiny:
481+
\begin{itemize}
482+
\item Kontrola symbolu$1$
483+
\begin{flushright}
484+
\begin{minipage}{0.90\textwidth}
485+
\begin{tabular}{r|l}
486+
\textit{A} &\texttt{if x\% 2 == 0 goto F;}\\
487+
\textit{B} &\texttt{x /= 2;}\\
488+
\textit{C} &\texttt{if x\% 2 == 1 goto E;}\\
489+
\textit{D} &\texttt{return 0;}\\
490+
\textit{E} &\texttt{x *= 2;}\\
491+
\textit{F} &\texttt{if x\% 2 == 0 goto K;}\\
492+
\textit{G} &\texttt{x /= 2;}\\
493+
\textit{H} &\texttt{if x\% 2 == 0 goto J;}\\
494+
\textit{I} & rutina pre zápis alebo posuv\\
495+
\textit{J} &\texttt{x *= 2;}\\
496+
\textit{K} &\texttt{NOOP;}
497+
\end{tabular}
498+
\end{minipage}
499+
\end{flushright}
500+
\item Kontrola symbolu$0$
501+
\begin{flushright}
502+
\begin{minipage}{0.90\textwidth}
503+
\begin{tabular}{r|l}
504+
\textit{A} &\texttt{if x\% 2 == 0 goto F;}\\
505+
\textit{B} &\texttt{x /= 2;}\\
506+
\textit{C} &\texttt{if x\% 2 == 1 goto E;}\\
507+
\textit{D} &\texttt{return 0;}\\
508+
\textit{E} &\texttt{x *= 2;}\\
509+
\textit{F} &\texttt{if x\% 2 == 1 goto K;}\\
510+
\textit{G} &\texttt{x /= 2;}\\
511+
\textit{H} &\texttt{if x\% 2 == 0 goto J;}\\
512+
\textit{I} & rutina pre zápis alebo posuv\\
513+
\textit{J} &\texttt{x *= 2;}\\
514+
\textit{K} &\texttt{NOOP;}
515+
\end{tabular}
516+
\end{minipage}
517+
\end{flushright}
518+
\item Kontrola symbolu$\Delta$
519+
\begin{flushright}
520+
\begin{minipage}{0.90\textwidth}
521+
\begin{tabular}{r|l}
522+
\textit{A} &\texttt{if x\% 2 == 0 goto F;}\\
523+
\textit{B} &\texttt{x /= 2;}\\
524+
\textit{C} &\texttt{if x\% 2 == 1 goto E;}\\
525+
\textit{D} &\texttt{return 0;}\\
526+
\textit{E} &\texttt{x *= 2;}\\
527+
\textit{F} &\texttt{if x\% 2 == 1 goto K;}\\
528+
\textit{G} &\texttt{x /= 2;}\\
529+
\textit{H} &\texttt{if x\% 2 == 1 goto J;}\\
530+
\textit{I} & rutina pre zápis alebo posuv\\
531+
\textit{J} &\texttt{x *= 2;}\\
532+
\textit{K} &\texttt{NOOP;}
533+
\end{tabular}
534+
\end{minipage}
535+
\end{flushright}
536+
\end{itemize}
537+
538+
Všetky rutiny obsahujú na ľavej strane kódu písmená ktoré reprezentujú číslné označenie jednotlivých po sebe idúcich riadkov.
418539

419540
\newpage
420541
\subsection{(b)}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp