course: tables, tags and refs

This commit is contained in:
2025-12-23 19:49:46 +03:00
parent a29bd250ab
commit 01eccd02ea
11 changed files with 345 additions and 579 deletions

View File

@ -1,3 +0,0 @@
section - страница
h1, h2, h3 - пункт, подпункт, подподпункт, отображаются в содержании

View File

@ -0,0 +1,19 @@
section - страница
h1, h2, h3 - пункт, подпункт, подподпункт, отображаются в содержании
img.alt - генерируемая подпись "Рисунок <number> - <alt>"
table.data-alt - генерируемая подпись "Таблица <number> - <alt>"
table.data-gen - генерация таблицы в формате "1,2;3,4;", где ',' разделяет колонки, ';' разделяет строки
$<action>,<param>,<param2>$
$C,<num>$ - установить colspan клетки
$c,<color>$ - установить цвет клетки, color = r | g | b
$$ - экранирование $
$, - экранирование ,
$; - экранирование ;
.tex - генерирует MathML на основе TeX
[data-tag] - у img или table при наличии alt или data-alt, позволяет ссылаться через data-ref
span.data-ref - заменяет содержимое элемента на idx элемента с соответствующим data-tag

View File

@ -1,55 +0,0 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36" version="28.2.8">
<diagram name="Страница — 1" id="sO6mBrgkGhevZXLxDi5B">
<mxGraphModel dx="744" dy="471" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="sDe38s09ArQUHBlkgSVm-1" value="A" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
<mxGeometry x="160" y="50" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-2" value="B" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
<mxGeometry x="160" y="100" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-3" value="C" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
<mxGeometry x="160" y="150" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-4" value="D" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
<mxGeometry x="160" y="230" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-6" value="начало" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.terminator;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="250" y="50" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-7" value="RA, RB" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0.23;" vertex="1" parent="1">
<mxGeometry x="242.5" y="100" width="75" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-12" value="1" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
<mxGeometry x="250" y="20" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-16" value="конец" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.terminator;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="250" y="230" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-41" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="sDe38s09ArQUHBlkgSVm-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="430" y="280" as="sourcePoint" />
<mxPoint x="280" y="150" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-42" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="sDe38s09ArQUHBlkgSVm-6" target="sDe38s09ArQUHBlkgSVm-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="430" y="280" as="sourcePoint" />
<mxPoint x="480" y="230" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-53" value="i = 2 * a1 + a0&lt;div&gt;CF = bi&lt;/div&gt;&lt;div&gt;bi = 1&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;absoluteArcSize=1;arcSize=14;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="235" y="150" width="90" height="60" as="geometry" />
</mxCell>
<mxCell id="sDe38s09ArQUHBlkgSVm-54" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="sDe38s09ArQUHBlkgSVm-53" target="sDe38s09ArQUHBlkgSVm-16">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="360" y="280" as="sourcePoint" />
<mxPoint x="410" y="230" as="targetPoint" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

Before

Width:  |  Height:  |  Size: 450 KiB

After

Width:  |  Height:  |  Size: 450 KiB

View File

Before

Width:  |  Height:  |  Size: 441 KiB

After

Width:  |  Height:  |  Size: 441 KiB

View File

Before

Width:  |  Height:  |  Size: 387 KiB

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 MiB

After

Width:  |  Height:  |  Size: 404 KiB

View File

@ -1,3 +1,7 @@
* {
margin: 0;
}
body { body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -7,7 +11,7 @@ body {
} }
html { html {
font: 12pt Times; font: 12pt "Tinos";
} }
section { section {
@ -18,6 +22,7 @@ section {
padding: 20mm 15mm 20mm 30mm; padding: 20mm 15mm 20mm 30mm;
background-color: white; background-color: white;
border-bottom: 1mm solid gray; border-bottom: 1mm solid gray;
overflow: hidden;
} }
header { header {
@ -37,26 +42,40 @@ h3 {
font-size: 1rem; font-size: 1rem;
} }
.colr {
gap: 5mm;
display: flex;
flex-direction: column-reverse;
}
.col { .col {
gap: 5mm;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 5mm;
} }
.row { .row {
gap: 5mm;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 5mm;
} }
.x-between { .x-between {
justify-content: space-between; justify-content: space-between;
} }
.x-center {
justify-content: center;
}
.x-end { .x-end {
justify-content: end; justify-content: end;
} }
.y-start {
align-items: start;
}
.y-center { .y-center {
align-items: center; align-items: center;
} }
@ -69,7 +88,7 @@ h3 {
text-align: center; text-align: center;
} }
.indent { p {
text-indent: 12.5mm; text-indent: 12.5mm;
} }
@ -110,3 +129,17 @@ h3 {
padding-left: 0.33em; padding-left: 0.33em;
background-color: white; background-color: white;
} }
img {
object-fit: contain;
}
table, td, th {
border-collapse: collapse;
border: 1px solid black;
}
.table-fixed {
width: 100%;
table-layout: fixed;
}

View File

@ -4,7 +4,11 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <title>Document</title>
<link rel="stylesheet" href="index.css"> <link rel="stylesheet" type="text/css" href="index.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Tinos:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
<script src="https://fred-wang.github.io/TeXZilla/TeXZilla-min.js"></script>
</head> </head>
<body> <body>
@ -34,15 +38,110 @@
<div class="center">Москва — 2025/2026</div> <div class="center">Москва — 2025/2026</div>
</div> </div>
</section> </section>
<section> <section style="background-image: url('README.jpg'); background-size: cover;">
<h1>Проектирование блока операций</h1>
<h2>Примеры и алгоритмы выполнения операций</h2>
<h3>Алгоритм операции УМНОЖЕНИЕ</h3>
</section> </section>
<section> <section class="col">
<h1>Проектирование блока операций</h1> <h1>Проектирование блока операций</h1>
<h2>Примеры и алгоритмы выполнения операций</h2> <h2>Примеры и алгоритмы выполнения операций</h2>
<h3>Алгоритм операции УМНОЖЕНИЕ</h3> <h3>Алгоритм операции УМНОЖЕНИЕ</h3>
<p>
Умножение выполняется по алгоритму умножения с младших разрядов множителя и сдвигом
суммы частичных произведений вправо с одним корректирующим шагом. Данный алгоритм при
представлении сомножителей в прямом коде можно выразить следующей формулой:
</p>
<div class="tex">
$$[A]_{\text{п}} = a_3, a_2 a_1 a_0$$
$$[A]_{\text{п}} \cdot [B]_{\text{п}} = (..((0 + A \cdot b_0) \cdot p^{-1} + A \cdot b_1) \cdot p^{-1} + ... + A \cdot b_{n-1}) \cdot p^{3}$$
</div>
<div class="row">
<div class="col x-center tex" style="gap: 0; flex: 1">
Пример 1:
$[\mathrm{A}]_\mathrm{п} = 0.111 = 7$
$[\mathrm{B}]_\mathrm{п} = 0.111 = 7$
$\mathrm{Зн} = 0 \oplus 0 = 0$
$[\mathrm{A}*\mathrm{B}]_\mathrm{п} = 0.0110001 = 49$
</div>
<table
data-alt="Пример умножения 1"
data-gen="
,,0,1,1,1,,,,RA;
,,0,1,1,1,,,,RB;;
,0,$c,r$0,$c,r$0,$c,r$0,$c,r$0,0,0,0,RR=0;
b0=1,,$c,r$0,$c,r$1,$c,r$1,$c,r$1,,,,RA;;
,0,0,1,1,1,0,0,0,RR;
,0,$c,r$0,$c,r$0,$c,r$1,$c,r$1,1,0,0,RR>>1;
b1=1,,$c,r$0,$c,r$1,$c,r$1,$c,r$1,,,,RA;;
,0,1,0,1,0,1,0,0,RR;
,0,$c,r$0,$c,r$1,$c,r$0,$c,r$1,0,1,0,RR>>1;
b2=1,,$c,r$0,$c,r$1,$c,r$1,$c,r$1,,,,RA;;
,0,1,1,0,0,0,1,0,RR;
Знак,$c,b$0,0,1,1,0,0,0,1,RR>>1;
"
class="center"
style="flex: 1"
></table>
</div>
<div class="row x-stretch">
<div class="col x-center tex" style="gap: 0; flex: 1">
Пример 2:
$[\mathrm{A}]_\mathrm{п} = 0.111 = 7$
$[\mathrm{B}]_\mathrm{п} = 1.101 = -5$
$\mathrm{Зн} = 1 \oplus 0 = 1$
$[\mathrm{A}*\mathrm{B}]_\mathrm{п} = 1.0100011 = -35$
</div>
<table
data-alt="Пример умножения 2"
data-gen="
,,0,1,1,1,,,,RA;
,,1,1,0,1,,,,RB;;
,0,$c,r$0,$c,r$0,$c,r$0,$c,r$0,0,0,0,RR=0;
b0=1,,$c,r$0,$c,r$1,$c,r$1,$c,r$1,,,,RA;;
,0,0,1,1,1,0,0,0,RR;
,0,0,0,1,1,1,0,0,RR>>1;
b1=0,$C,9$пропуск такта суммирования;;
,0,0,0,1,1,1,0,0,RR;
,0,$c,r$0,$c,r$0,$c,r$0,$c,r$1,1,1,0,RR>>1;
b2=1,,$c,r$0,$c,r$1,$c,r$1,$c,r$1,,,,RA;;
,0,1,0,0,0,1,1,0,RR;
Знак,$c,b$1,0,1,0,0,0,1,1,RR>>1;
"
class="center"
style="flex: 1"
></table>
</div>
</section>
<section class="col">
<p>Представим рассмотренный метод умножения в виде схемы алгоритма на рисунке <span data-ref="bo-mul"></span></p>
<div class="col y-center">
<img alt="Блок схема умножения" data-tag="bo-mul" src="img/bo-mul.png" style="width: 50%">
</div>
<h3>Проверка бита с установкой его в единицу</h3>
<p>Операция проверяет бит в RB по адресу из RA, устанавливает флаг CF, если значение бита в операнде 1, значение бита в операнде устанавливается в 1</p>
<div class="row y-center">
<img style="flex: 0.6" src="img/bo-set.png" alt="Блок схема проверки бита с установкой в единицу">
<div style="flex: 0.4"></div>
<div style="flex: 1" class="col x-center tex">
<div class="col" style="gap: 0">
Пример 1:
$RA = 0000$
$RB = 0001$
$CF = 1$
$RB = 0001$
</div>
<div class="col" style="gap: 0">
Пример 2:
$RA = 0001$
$RB = 0001$
$CF = 0$
$RB = 0011$
</div>
</div>
</div>
</section>
<section class="col">
<h2>Функциональная схема блока операций</h2>
<p>Функциональная схема блока операций представлена на рисунке <span data-ref="bo-func"></span></p>
<img src="img/bo-func.png" alt="Функциональная схема блока операций" data-tag="bo-func">
</section> </section>
<script src="index.js" type="module"></script> <script src="index.js" type="module"></script>
</body> </body>

View File

@ -1,70 +1,188 @@
class CTX { function addPageNumbers() {
addPageNumbers() { let pages = document.getElementsByTagName('section')
let pages = this.pages
for (let i = 2; i <= pages.length; i++) {
let div = document.createElement('div')
div.classList.add('page-number')
div.textContent = i
pages[i - 1].appendChild(div)
}
}
addTableOfContents() { for (let i = 2; i <= pages.length; i++) {
let hs = document.querySelectorAll('h1,h2,h3') let div = document.createElement('div')
let ol = document.createElement('ol') div.classList.add('page-number')
ol.classList.add('table-of-contents') div.textContent = i
pages[i - 1].appendChild(div)
let prefix_counter = [0, 0, 0]
let page_counter = 2
let page
for (let h of hs) {
let level = {
'H1': 0,
'H2': 1,
'H3': 2,
}[h.tagName]
prefix_counter[level]++
for (let i = level + 1; i < prefix_counter.length; i++)
prefix_counter[i] = 0
let prefix = ''
for (let i = 0; i <= level; i++)
prefix += prefix_counter[i] + '.'
prefix = prefix.slice(0, prefix.length - 1)
console.log(h.tagName)
let li = document.createElement('li')
let name = document.createElement('span')
let page_number = document.createElement('span')
name.innerHTML = prefix + ' - ' + h.innerHTML
let cur_page = h.closest('section')
if (page != cur_page) {
page = cur_page
page_counter++
}
page_number.innerHTML = page_counter
li.append(name, page_number)
ol.appendChild(li)
}
let header = document.createElement('header')
header.innerText = 'Содержание'
this.pages[0].after(document.createElement('section'))
this.pages[1].appendChild(header)
this.pages[1].appendChild(ol)
}
get pages() {
return document.getElementsByTagName('section')
} }
} }
let ctx = new CTX function addTableOfContents() {
ctx.addTableOfContents() let pages = document.getElementsByTagName('section')
ctx.addPageNumbers() let hs = document.querySelectorAll('h1,h2,h3')
let ol = document.createElement('ol')
ol.classList.add('table-of-contents')
let prefix_counter = [0, 0, 0]
let page_counter = 2
let page
for (const h of hs) {
let level = {
'H1': 0,
'H2': 1,
'H3': 2,
}[h.tagName]
prefix_counter[level]++
for (let i = level + 1; i < prefix_counter.length; i++)
prefix_counter[i] = 0
let prefix = ''
for (let i = 0; i <= level; i++)
prefix += prefix_counter[i] + '.'
prefix = prefix.slice(0, prefix.length - 1)
let li = document.createElement('li')
let name = document.createElement('span')
let page_number = document.createElement('span')
name.innerHTML = prefix + ' - ' + h.innerHTML
h.innerHTML = name.innerHTML
let cur_page = h.closest('section')
if (page != cur_page) {
page = cur_page
page_counter++
}
page_number.innerHTML = page_counter
li.append(name, page_number)
ol.appendChild(li)
}
let header = document.createElement('header')
header.innerText = 'Содержание'
let section = document.createElement('section')
section.classList.add('col')
pages[0].after(section)
pages[1].appendChild(header)
pages[1].appendChild(ol)
}
function addCaptions() {
const objs = document.querySelectorAll('img, table')
const obj_counter = {
'IMG': 1,
'TABLE': 1,
}
const counter_by_tag = {}
for (const obj of objs) {
const cap = document.createElement('caption')
const prefix = {
'IMG': 'Рисунок ',
'TABLE': 'Таблица ',
}[obj.tagName] + obj_counter[obj.tagName]
cap.innerHTML = prefix + ' - ' + {
'IMG': obj.alt,
'TABLE': obj.dataset.alt,
}[obj.tagName]
if (obj.dataset.tag) {
counter_by_tag[obj.dataset.tag] = obj_counter[obj.tagName]
}
let div = document.createElement('div')
div.classList.add(...({
'IMG': ['col'],
'TABLE': ['colr', 'y-start'],
})[obj.tagName])
div.style.cssText = obj.style.cssText
obj.style.cssText = 'width: 100%'
let prev = obj.previousSibling
obj.remove()
div.append(obj, cap)
prev.after(div)
obj_counter[obj.tagName]++
}
const refs = document.querySelectorAll('span[data-ref]')
console.log(refs)
for (const ref of refs) {
ref.innerHTML = counter_by_tag[ref.dataset.ref] ?? 'без номера'
}
}
function genTables() {
let tables = document.getElementsByTagName('table')
for (const table of tables) {
if (!table.dataset.gen)
continue
let row = document.createElement('tr')
let dot = document.createElement('td')
let value = ''
const gen = table.dataset.gen
for (let i = 0; i < gen.length;) {
const char = gen[i]
switch (char) {
case ',':
dot.innerHTML = value
value = ''
row.appendChild(dot)
dot = document.createElement('td')
i++
break
case ';':
dot.innerHTML = value
value = ''
row.appendChild(dot)
dot = document.createElement('td')
table.appendChild(row)
row = document.createElement('tr')
i++
break
case '$':
const args_end = gen.indexOf('$', i+2)
const args = gen.slice(i+1, args_end).split(',')
switch (args[0]) {
case 'C':
dot.colSpan = +args[1]
break
case 'c':
dot.style.backgroundColor = {
'r': 'lightcoral',
'g': 'lightgreen',
'b': 'lightblue',
}[args[1]] ?? 'white'
break
}
i = args_end + 1
break
default:
value += char
i++
break
}
}
}
}
function genMathML() {
TeXZilla.setSafeMode(true)
const maths = document.querySelectorAll('.tex')
for (const math of maths)
TeXZilla.filterElement(math)
}
addTableOfContents()
addPageNumbers()
addCaptions()
genTables()
genMathML()

View File

@ -1,445 +0,0 @@
\documentclass[12pt,a4paper,oneside]{article}
\usepackage[a4paper,left=2cm,right=1cm,top=2cm,bottom=2cm]{geometry}
\usepackage{polyglossia}
\setmainlanguage{russian}
\PolyglossiaSetup{russian}{indentfirst=true}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{caption}
\DeclareCaptionLabelFormat{gost}{#1~\textbf{#2}.}
\DeclareCaptionLabelSeparator{gost}{~}
\captionsetup[figure]{
labelsep = gost,
labelformat = gost,
justification = centering,
font = {normalsize, bf},
position = bottom,
skip = 10pt
}
\captionsetup[table]{
labelsep = gost,
labelformat = gost,
justification = centering,
font = {normalsize, bf},
position = top,
skip = 5pt
}
\makeatletter
\@addtoreset{figure}{section}
\@addtoreset{table}{section}
\makeatother
\setmainfont{Times New Roman}
\setromanfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Courier New}
\usepackage{amsmath}
\newfontfamily{\cyrillicfont}{Times New Roman}
\newfontfamily{\cyrillicfontrm}{Times New Roman}
\newfontfamily{\cyrillicfonttt}{Courier New}
\newfontfamily{\cyrillicfontsf}{Arial}
\usepackage{graphicx}
\graphicspath{{img/}}
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage{makecell}
\usepackage[table]{xcolor}
\begin{document}
\begin{titlepage}
\begin{center}
\begin{large}
Национальный исследовательский ядерный университет <<МИФИ>> \\
\vspace{0.25cm}
Институт интеллектуальных кибернетических систем \\
\vspace{0.25cm}
Кафедра №12 <<Компьютерные системы и технологии>>
\end{large}
\vspace*{1cm}
\begin{figure}[H]
\centering
\begin{minipage}[c]{0.2\textwidth}
\includegraphics[width=\textwidth]{logo_university}
\end{minipage}
\hfill
\begin{minipage}[c]{0.1\textwidth}
\includegraphics[width=\textwidth]{logo_institute}
\end{minipage}
\hfill
\begin{minipage}[c]{0.3\textwidth}
\includegraphics[width=\textwidth]{logo_department}
\end{minipage}
\end{figure}
\vspace{4cm}
\begin{huge}
\textbf{Курсовой проект}
\end{huge}
\begin{large}
\textbf{<<Проектирование процессора>>}
\end{large}
\vfill
\begin{flushright}
\begin{tabular}{ r l }
\textbf{удент:} & Литвинов В.\,А. \\
\textbf{Группа:} & Б23-503 \\
\textbf{Преподаватель:} & Ядыкин И.\,М. \\
\end{tabular}
\end{flushright}
Москва --- 2025/2026
\end{center}
\end{titlepage}
\setcounter{page}{2}
\tableofcontents
\newpage
\section{Проектирование блока операций}
\subsection{Примеры и алгоритмы выполнения операций}
\subsubsection{Алгоритм операции УМНОЖЕНИЕ}
Умножение выполняется по алгоритму умножения с младших разрядов множителя и сдвигом суммы частичных произведений вправо с одним корректирующим шагом. Данный алгоритм при представлении сомножителей в прямом коде можно выразить следующей формулой:
$$[A]_{\text{п}} = a_3, a_2 a_1 a_0$$
\begin{equation}
[A]_{\text{п}} \cdot [B]_{\text{п}}=(..((0 + A \cdot b_0) \cdot p^{-1} + A \cdot b_1) \cdot p^{-1} + ... + A \cdot b_{n-1}) \cdot p^{3}
\end{equation}
\begin{figure}[H]
\centering
\begin{minipage}{0.3\textwidth}
\centering
\makecell[l]{
Пример 1: \\
$[\mathrm{A}]_\mathrm{п} = 0.111 = 7$\\
$[\mathrm{B}]_\mathrm{п} = 0.111 = 7$\\
$\mathrm{Зн} = 0 \oplus 0 = 0$\\
$[\mathrm{A}*\mathrm{B}]_\mathrm{п} = 0.0110001 = 49$
}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\centering
\begin{tabular}{c|c|c|c|c|c|c|c|c|c}
& & 0 & 1 & 1 & 1 & & & & \makecell[l]{RA} \\
& & 0 & 1 & 1 & 1 & & & & \makecell[l]{RB}\\ \hline
& 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \makecell[l]{RR = 0} \\
$b_0 = 1$ & & 0 & 1 & 1 & 1 & & & & \makecell[l]{RA} \\ \hline
& 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & \makecell[l]{RR} \\
& 0 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & \makecell[l]{RR >> 1} \\
$b_1 = 1$ & & 0 & 1 & 1 & 1 & & & & \makecell[l]{RA} \\ \hline
& 0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & \makecell[l]{RR} \\
& 0 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & \makecell[l]{RR >> 1} \\
$b_2 = 1$ & & 0 & 1 & 1 & 1 & & & & \makecell[l]{RA} \\ \hline
& 0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & \makecell[l]{RR} \\
$\mathrm{Знак}$&\cellcolor{lightgray}0 & 0 & 1 & 1 & 0 & 0 & 0 & 1 & \makecell[l]{RR >> 1}
\end{tabular}
\end{minipage}
\end{figure}
\begin{figure}[H]
\centering
\begin{minipage}{0.3\textwidth}
\centering
\makecell[l]{
Пример 2: \\
$[\mathrm{A}]_\mathrm{п} = 0.111 = 7$\\
$[\mathrm{B}]_\mathrm{п} = 1.101 = -5$\\
$\mathrm{Зн} = 1 \oplus 0 = 1$\\
$[\mathrm{A}*\mathrm{B}]_\mathrm{п} = 1.0100011 = -35$
}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\centering
\begin{tabular}{c|c|c|c|c|c|c|c|c|c}
& & 0 & 1 & 1 & 1 & & & & \makecell[l]{RA} \\
& & 1 & 1 & 0 & 1 & & & & \makecell[l]{RB}\\ \hline
& 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \makecell[l]{RR = 0} \\
$b_0 = 1$ & & 0 & 1 & 1 & 1 & & & & \makecell[l]{RA} \\ \hline
& 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & \makecell[l]{RR} \\
& 0 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & \makecell[l]{RR >> 1} \\
$b_1 = 0$ & \multicolumn{9}{l}{\text{пропуск такта суммирования}} \\ \hline
& 0 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & \makecell[l]{RR} \\
& 0 & 0 & 0 & 0 & 1 & 1 & 1 & 0 & \makecell[l]{RR >> 1} \\
$b_2 = 1$ & & 0 & 1 & 1 & 1 & & & & \makecell[l]{RA} \\ \hline
& 0 & 1 & 0 & 0 & 0 & 1 & 1 & 0 & \makecell[l]{RR} \\
$\mathrm{Знак}$&\cellcolor{lightgray}1 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & \makecell[l]{RR >> 1}
\end{tabular}
\end{minipage}
\end{figure}
\newpage
\begin{figure}[H]
\centering
Представим рассмотренный метод умножения в виде схемы алгоритма \\
\begin{minipage}[t]{\textwidth}
\centering
\includegraphics[width=0.6\textwidth]{bo-mut}
\caption{Блок схема умножения}
\label{bo-mut}
\end{minipage}
\end{figure}
\subsubsection{Проверка бита с установкой его в единицу}
Операция проверяет бит в RB по адресу из RA, устанавливает флаг CF, если значение бита в операнде 1, значение бита в операнде устанавливается в 1
\begin{figure}[H]
\centering
\makecell{
Пример 1: \\
$RA = 0000$ \\
$RB = 0001$ \\
$CF = 1$ \\
$RB = 0001$ \\ \\
Пример 2: \\
$RA = 0001$ \\
$RB = 0001$ \\
$CF = 0$ \\
$RB = 0011$
}
\makecell{
\begin{minipage}[t]{0.2\textwidth}
\centering
\includegraphics[width=\textwidth]{bo-set}
\caption{Блок схема проверки бита с установкой в единицу}
\label{bo-set}
\end{minipage}
}
\end{figure}
\newpage
\subsection{Функциональная схема блока операций}
Функциональная схема блока операций представлена на рис. \ref{bo-func}
\begin{figure}[H]
\centering
\begin{minipage}[t]{\textwidth}
\centering
\includegraphics[width=\textwidth]{bo-func}
\caption{Блок схема умножения}
\label{bo-func}
\end{minipage}
\end{figure}
\newpage
В таблице \ref{bo-table} приведены все элементы функциональной схемы блока операций
\begin{table}[H]
\centering
\begin{minipage}[t]{\textwidth}
\centering
\begin{tabular}{|p{0.1\textwidth}|p{0.4\textwidth}|p{0.4\textwidth}|}
Обознач & Назначение УМНОЖЕНИЕ & ПРОВЕРКА БИТА \\ \hline
RA & Регистр 1-го операнда, 4 разряда, множимое, параллельная загрузка, хранение & позиция бита, параллельная загрузка \\ \hline
RB & Регистр 2-го операнда, 4 разряда, множитель, параллельная загрузка 4 старших бит, хранение, формирование сигнала F0 & регистр данных, параллельная загрузка \\ \hline
RR & Регистр результата, 8 разрядов, параллельная загрузка, хранение, сдвиг вправо на 1 разряд & новое значение регистра RB, 4 старших разряда, параллельная загрузка, хранение \\ \hline
TCF & & Регистр флага CF, 1 разряд, параллельная загрузка, хранение \\ \hline
TS & Регистр знака результата, 1 разряд, параллельная загрузка, хранение & \\ \hline
КС1 & Формирование знака результата умножения & \\ \hline
КС2 & Формирование нового значения RB в RR[3:0] и проверенного бита RB_i & \\ \hline
SM & 4-разрядный сумматор & \\ \hline
& &
\end{tabular}
\caption{Элементы функциональной схемы}
\label{bo-table}
\end{minipage}
\end{table}
\newpage
\subsection{Проектирование логических элементов блока операций}
\subsubsection{Регистр первого операнда RA}
Данный регистр является четырёхразрядным регистром хранения. Наиболее подходящим для реализации функций регистра RA является регистр FD4CE
\begin{minipage}{0.3\textwidth}
\centering
Таблица управляющих сигналов RA
\begin{tabular}{|c|c|}
\hline
Y0 & Назначение \\ \hline
0 & Хранение \\ \hline
1 & Загрузка \\ \hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=0.3\textwidth]{bo-ra}
\caption{Логическая схема RA}
\label{bo-ra}
\end{figure}
\end{minipage}
\subsubsection{Регистр второго операнда RB}
Данный регистр является четырёхразрядным регистром хранения. Наиболее подходящим для реализации функций регистра RB является регистр FD4CE
\begin{minipage}{0.3\textwidth}
\centering
Таблица управляющих сигналов RB
\begin{tabular}{|c|c|}
\hline
Y0 & Назначение \\ \hline
0 & Хранение \\ \hline
1 & Загрузка \\ \hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=0.3\textwidth]{bo-rb}
\caption{Логическая схема RB}
\label{bo-rb}
\end{figure}
\end{minipage}
\subsubsection{Регистр результата RR}
Данный регистр является 8-разрядным регистром с логическим сдвигом вправо на 1 разряд, хранением, параллельной загрузкой. Наиболее подходящим для реализации функции регистра RR является регистр SR8CLE
\begin{minipage}{0.3\textwidth}
\centering
Таблица управляющих сигналов RR
\begin{tabular}{|c|c|c|}
\hline
Y5 & Y4 & Назначение \\ \hline
0 & 0 & Хранение \\ \hline
0 & 1 & Загрузка \\ \hline
1 & 0 & SHR \\ \hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{bo-rr}
\caption{Логическая схема RR}
\label{bo-rr}
\end{figure}
\end{minipage}
\subsubsection{Регистр признака RPR}
Данный регистр является 1-разрядным с хранением и загрузкой. Наиболее подходящим для реализации функции регистра RPR является
\begin{minipage}{0.3\textwidth}
\centering
Таблица управляющих сигналов RPR
\begin{tabular}{|c|c|}
\hline
Y7 & Назначение \\ \hline
0 & Хранение \\ \hline
1 & Загрузка \\ \hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=0.3\textwidth]{bo-rpr}
\caption{Логическая схема RPR}
\label{bo-rpr}
\end{figure}
\end{minipage}
\subsubsection{Комбинационная схема КC1}
С помощью комбинационной схемы КС1 осуществляется выбор множимого из RB или RR[6:3], а также формируется сигнал F0 для МУУ
\begin{minipage}{0.3\textwidth}
\centering
Таблица управляющих сигналов КС1
\begin{tabular}{|c|c|}
\hline
Y6 & Назначение \\ \hline
0 & Выбор RB \\ \hline
1 & Выбор RR[6:3] \\ \hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{bo-cs1}
\caption{Логическая схема КС1}
\label{bo-cs1}
\end{figure}
\end{minipage}
\newpage
\subsubsection{Комбинационная схема КC2}
С помощью комбинационной схемы КС2 осуществляется формирование знака для операции умножени, формирование нового значения RB с установленным битом и формирование флага CF для операции установки бита
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{bo-cs2}
\caption{Логическая схема КС2}
\label{bo-cs2}
\end{figure}
\newpage
\subsubsection{Комбинационная схема КC3}
С помощью комбинационной схемы КС3 осуществляется загрузка промежуточной суммы в RR[6:3] и знака в RR[7] в операции умножения, нового значения RB с установленными битами в RR[6:3] в операции установки бита
\begin{minipage}{0.3\textwidth}
\centering
Таблица управляющих сигналов КС3
\begin{tabular}{|c|c|c|}
\hline
Y3 & Y2 & Назначение \\ \hline
0 & 0 & сумма в RR[6:3] \\ \hline
0 & 1 & знак RR[7] \\ \hline
1 & 0 & значение RB в RR[6:3] \\ \hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.69\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{bo-cs3}
\caption{Логическая схема КС3}
\label{bo-cs3}
\end{figure}
\end{minipage}
\newpage
\subsubsection{Сумматор SM}
4-разрядный, старшие разряды множимого и множителя, carry input установлены в 0
\begin{minipage}{\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{bo-sm}
\caption{Логическая схема SM}
\label{bo-sm}
\end{figure}
\end{minipage}
\newpage
\subsection{Логическая схема блока операций}
\begin{minipage}{\textwidth}
\begin{figure}[H]
\centering
\includegraphics[width=\textwidth]{bo-scheme}
\caption{Логическая схема БО}
\label{bo-scheme}
\end{figure}
\end{minipage}
\end{document}