This commit is contained in:
Jose
2024-10-10 09:10:04 +02:00
commit d7b678f33a
381 changed files with 54014 additions and 0 deletions

1
.obsidian/.obsidian/app.json vendored Normal file
View File

@@ -0,0 +1 @@
{}

1
.obsidian/.obsidian/appearance.json vendored Normal file
View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,30 @@
{
"file-explorer": true,
"global-search": true,
"switcher": true,
"graph": true,
"backlink": true,
"canvas": true,
"outgoing-link": true,
"tag-pane": true,
"properties": false,
"page-preview": true,
"daily-notes": true,
"templates": true,
"note-composer": true,
"command-palette": true,
"slash-command": false,
"editor-status": true,
"bookmarks": true,
"markdown-importer": false,
"zk-prefixer": false,
"random-note": false,
"outline": true,
"word-count": true,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": false
}

20
.obsidian/.obsidian/core-plugins.json vendored Normal file
View File

@@ -0,0 +1,20 @@
[
"file-explorer",
"global-search",
"switcher",
"graph",
"backlink",
"canvas",
"outgoing-link",
"tag-pane",
"page-preview",
"daily-notes",
"templates",
"note-composer",
"command-palette",
"editor-status",
"bookmarks",
"outline",
"word-count",
"file-recovery"
]

143
.obsidian/.obsidian/workspace.json vendored Normal file
View File

@@ -0,0 +1,143 @@
{
"main": {
"id": "0eddd5807a24aecc",
"type": "split",
"children": [
{
"id": "87ee767805676445",
"type": "tabs",
"children": [
{
"id": "e4709096ed169b23",
"type": "leaf",
"state": {
"type": "empty",
"state": {}
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "44c5298e71d78211",
"type": "split",
"children": [
{
"id": "ecabb6a43ac59c62",
"type": "tabs",
"children": [
{
"id": "f04962d3c3c68719",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
}
}
},
{
"id": "4145bf5d137f2b03",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
}
},
{
"id": "75c024d55c4a2546",
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "8cccdd1dd5206d9f",
"type": "split",
"children": [
{
"id": "10adf89e0471f432",
"type": "tabs",
"children": [
{
"id": "ded88b1729325ac5",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "717d41b53d8b7e93",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"linksCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "af307479b8a25b96",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
}
}
},
{
"id": "a8c1336daf1c783b",
"type": "leaf",
"state": {
"type": "outline",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"canvas:Create new canvas": false,
"daily-notes:Open today's daily note": false,
"templates:Insert template": false,
"command-palette:Open command palette": false
}
},
"active": "e4709096ed169b23",
"lastOpenFiles": []
}

3
.obsidian/app.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"promptDelete": false
}

8
.obsidian/appearance.json vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"theme": "moonstone",
"accentColor": "#5f78f1",
"enabledCssSnippets": [
"nota"
],
"cssTheme": ""
}

10
.obsidian/bookmarks.json vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"items": [
{
"type": "file",
"ctime": 1727683811390,
"path": "SEGUNDO/DSD/Teoría_2324.md",
"title": "APUNTES"
}
]
}

10
.obsidian/community-plugins.json vendored Normal file
View File

@@ -0,0 +1,10 @@
[
"highlightr-plugin",
"obsidian-plantuml",
"table-editor-obsidian",
"iconic",
"obsidian-banners",
"obsidian-enhancing-export",
"obsidian-latex-suite",
"obsidian-git"
]

30
.obsidian/core-plugins-migration.json vendored Normal file
View File

@@ -0,0 +1,30 @@
{
"file-explorer": true,
"global-search": true,
"switcher": true,
"graph": true,
"backlink": true,
"canvas": true,
"outgoing-link": true,
"tag-pane": true,
"properties": false,
"page-preview": true,
"daily-notes": true,
"templates": true,
"note-composer": true,
"command-palette": true,
"slash-command": false,
"editor-status": true,
"bookmarks": true,
"markdown-importer": false,
"zk-prefixer": false,
"random-note": false,
"outline": true,
"word-count": true,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": false
}

20
.obsidian/core-plugins.json vendored Normal file
View File

@@ -0,0 +1,20 @@
[
"file-explorer",
"global-search",
"switcher",
"graph",
"backlink",
"canvas",
"outgoing-link",
"tag-pane",
"page-preview",
"daily-notes",
"templates",
"note-composer",
"command-palette",
"editor-status",
"bookmarks",
"outline",
"word-count",
"file-recovery"
]

22
.obsidian/graph.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"collapse-filter": true,
"search": "",
"showTags": false,
"showAttachments": false,
"hideUnresolved": false,
"showOrphans": true,
"collapse-color-groups": true,
"colorGroups": [],
"collapse-display": true,
"showArrow": false,
"textFadeMultiplier": 0,
"nodeSizeMultiplier": 1,
"lineSizeMultiplier": 1,
"collapse-forces": true,
"centerStrength": 0.518713248970312,
"repelStrength": 10,
"linkStrength": 1,
"linkDistance": 250,
"scale": 1,
"close": true
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "highlightr-plugin",
"name": "Highlightr",
"version": "1.2.2",
"minAppVersion": "0.12.8",
"description": "A minimal and aesthetically pleasing highlighting menu that makes color-coded highlighting much easier with a configurable assortment of highlight colors 🎨.",
"author": "chetachi",
"authorUrl": "https://github.com/chetachiezikeuzor",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,774 @@
/*highlighter style*/
/*lowlight*/
.highlightr-lowlight mark,
.highlightr-lowlight span.cm-highlight,
.highlightr-lowlight .markdown-preview-view mark {
--lowlight-background: var(--background-primary);
border-radius: 0;
background-image: linear-gradient(
360deg,
rgba(255, 255, 255, 0) 40%,
var(--lowlight-background) 40%
) !important;
}
.highlightr-lowlight .workspace-split.mod-left-split mark,
.highlightr-lowlight .workspace-split.mod-left-split span.cm-highlight,
.highlightr-lowlight
.workspace-split.mod-left-split
.markdown-preview-view
mark,
.highlightr-lowlight .workspace-split.mod-right-split mark,
.highlightr-lowlight .workspace-split.mod-right-split span.cm-highlight,
.highlightr-lowlight
.workspace-split.mod-right-split
.markdown-preview-view
mark {
--lowlight-background: var(--background-secondary);
}
.highlightr-lowlight .admonition-content mark,
.highlightr-lowlight .admonition-content span.cm-highlight,
.highlightr-lowlight .admonition-content > .markdown-preview-view mark {
--lowlight-background: var(--background-primary-alt);
}
/*floating*/
.highlightr-floating mark,
.highlightr-floating span.cm-highlight,
.highlightr-floating .markdown-preview-view mark {
--floating-background: var(--background-primary);
border-radius: 0;
padding-bottom: 5px;
background-image: linear-gradient(
360deg,
rgba(255, 255, 255, 0) 28%,
var(--floating-background) 28%
) !important;
}
.highlightr-floating .workspace-split.mod-left-split mark,
.highlightr-floating .workspace-split.mod-left-split span.cm-highlight,
.highlightr-floating
.workspace-split.mod-left-split
.markdown-preview-view
mark,
.highlightr-floating .workspace-split.mod-right-split mark,
.highlightr-floating .workspace-split.mod-right-split span.cm-highlight,
.highlightr-floating
.workspace-split.mod-right-split
.markdown-preview-view
mark {
--floating-background: var(--background-secondary);
}
.highlightr-floating .admonition-content mark,
.highlightr-floating .admonition-content span.cm-highlight,
.highlightr-floating .admonition-content > .markdown-preview-view mark {
--floating-background: var(--background-primary-alt);
}
/*rounded*/
.highlightr-rounded mark,
.highlightr-rounded .markdown-preview-view mark {
margin: 0 -0.05em;
padding: 0.125em 0.15em;
border-radius: 0.2em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.highlightr-rounded span.cm-highlight {
border-radius: 0.2em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.highlightr-rounded .cm-s-obsidian span.cm-highlight {
font-weight: inherit;
}
.highlightr-rounded .cm-highlight + span.cm-formatting-highlight {
padding-left: 0em;
padding-right: 0.15em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
/*realistic*/
.highlightr-realistic mark,
.highlightr-realistic .markdown-preview-view mark {
margin: 0 -0.05em;
padding: 0.1em 0.4em;
border-radius: 0.8em 0.3em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
text-shadow: 0 0 0.75em var(--background-primary-alt);
}
.highlightr-realistic.hide-tokens .cm-s-obsidian span.cm-highlight,
.hide-tokens.highlightr-realistic .cm-s-obsidian span.cm-highlight {
border-radius: 0.8em 0.3em;
}
.highlightr-realistic .cm-s-obsidian span.cm-highlight {
padding: 0.15em 0.25em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
text-shadow: 0 0 0.75em var(--background-primary-alt);
}
.highlightr-realistic .cm-s-obsidian span.cm-formatting-highlight {
margin: 0 0 0 -0.05em;
padding: 0.15em 0.25em;
border-radius: 0.8em 0 0 0.3em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.highlightr-realistic
.cm-s-obsidian
.cm-highlight
+ span.cm-formatting-highlight {
margin: 0 -0.05em 0 0;
padding: 0.15em 0.25em;
border-radius: 0 0.3em 0.8em 0;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
/**/
button.copy-highlights {
padding: 4px 14px;
border-radius: 5px;
background-color: var(--interactive-accent);
}
.copy-highlights svg {
width: 1.3em;
height: 1.3em;
display: flex;
}
details summary.highlight-summary:before {
width: 2em;
height: 2em;
content: "☐";
font-size: 9px;
cursor: pointer;
margin-right: 5px;
display: inline-block;
vertical-align: 0.05em;
background-color: currentColor;
-webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="black" d="M10.707 17.707L16.414 12l-5.707-5.707l-1.414 1.414L13.586 12l-4.293 4.293z"></path></svg>');
}
details[open] summary.highlight-summary::before {
transform: rotate(90deg);
}
/*highlightr component*/
@keyframes fade {
0% {
opacity: 0;
}
20% {
opacity: 0.9;
}
40% {
opacity: 0.95;
}
100% {
opacity: 1;
}
}
.menu.highlighterContainer {
min-width: 140px;
max-width: 225px;
max-height: 180px;
padding-left: 0em;
padding: 0;
margin: 0 auto;
border-radius: 6px;
font-size: 14px;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
animation: fade 300ms ease-in-out;
background-color: var(--background-primary);
box-shadow: 0px 3px 25px rgba(31, 38, 135, 0.1);
border: 1px solid var(--background-modifier-border);
}
.menu.highlighterContainer .menu-item .menu-item-icon {
display: inline-block;
width: 25px;
position: relative;
top: 2px;
}
.menu.highlighterContainer .menu-item {
display: flex;
padding: 2px 14px 3px 14px;
align-items: unset;
margin: auto;
cursor: pointer;
font-size: 14px;
height: 32px;
line-height: 31px;
white-space: nowrap;
border-radius: 0;
border-bottom: 1px solid var(--background-modifier-border);
}
.menu.highlighterContainer .menu-item:last-of-type {
border-bottom: none;
}
/*----------------------------------------------------------------
SETTINGS TAB
----------------------------------------------------------------*/
button.HighlightrSettingsButton {
padding: 4px 14px;
border-radius: 6px;
height: fit-content;
}
button.HighlightrSettingsButton svg {
width: 1.3em;
height: 1.3em;
display: flex;
}
.highlighter-settings-color,
.highlighter-settings-value {
width: 42%;
color: var(--text-normal);
}
.highlighterplugin-setting-item {
display: block;
}
.highlighterplugin-setting-item .setting-item-control {
justify-content: space-between;
margin-top: 12px;
align-content: center;
align-items: flex-end;
grid-gap: 6px;
}
.modal.mod-settings
button:not(.mod-cta):not(.mod-warning).HighlightrSettingsButton.HighlightrSettingsButtonAdd,
button:not(.mod-cta):not(.mod-warning).HighlightrSettingsButton.HighlightrSettingsButtonAdd {
background-color: var(--interactive-accent);
}
.modal.mod-settings
button:not(.mod-cta):not(.mod-warning).HighlightrSettingsButton.HighlightrSettingsButtonDelete,
button:not(.mod-cta):not(.mod-warning).HighlightrSettingsButton.HighlightrSettingsButtonDelete {
background-color: #989cab;
}
/**/
.highlighter-setting-icon {
display: flex;
height: 24px;
width: 24px;
}
.highlighter-item-draggable {
cursor: grab;
display: grid;
grid-gap: 8px;
grid-template-columns: 0.5fr 7fr;
align-items: center;
border-top: 1px solid var(--background-modifier-border);
}
.HighlightrSettingsTabsContainer {
border-bottom: 1px solid var(--background-modifier-border);
}
.setting-item.highlighter-setting-item:first-child {
padding-top: 18px;
}
.highlighter-setting-item {
padding: 18px 0 18px 0;
border-top: none;
}
.highlighter-sortable-fallback {
cursor: grabbing;
box-shadow: 0px 3px 32px rgb(31 38 135 / 15%);
}
.highlighter-sortable-grab {
cursor: grabbing !important;
}
.highlighter-sortable-ghost {
opacity: 0.4;
cursor: grabbing;
}
.highlighter-sortable-chosen {
cursor: grabbing;
padding: 0 0 0 18px;
background-color: var(--background-primary);
}
.highlighter-sortable-drag {
cursor: grabbing;
box-shadow: 0px 3px 32px rgb(31 38 135 / 15%);
}
/*----------------------------------------------------------------
HIGHLIGHTR SUPPORT
----------------------------------------------------------------*/
.hltrDonationSection {
width: 65%;
height: 50vh;
margin: 0 auto;
text-align: center;
color: var(--text-normal);
}
.pcr-app .pcr-swatches > button {
padding: 0;
}
.pickr .pcr-button {
margin-right: 0;
}
.themed-color-wrapper > div {
background: var(--background-primary);
padding: 10px;
display: flex;
align-items: center;
border-radius: 4px;
}
.themed-color-wrapper > div + div {
margin-top: 6px;
}
.themed-color-wrapper button {
display: block;
}
.themed-color-wrapper .pickr-reset > button {
margin: 0 0 0 10px;
padding: 9px;
line-height: 1;
}
.themed-color-wrapper .pickr-reset > button > svg {
display: block;
}
/*----------------------------------------------------------------
PICKR 1.8.2 MIT | https://github.com/Simonwep/pickr
----------------------------------------------------------------*/
.pickr {
position: relative;
overflow: visible;
transform: translateY(0);
}
.pickr * {
box-sizing: border-box;
outline: none;
border: none;
-webkit-appearance: none;
}
.pickr .pcr-button {
position: relative;
height: 2em;
width: 2em;
padding: 0.5em;
cursor: pointer;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Helvetica Neue", Arial, sans-serif;
border-radius: 0.15em;
background: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" stroke="%2342445A" stroke-width="5px" stroke-linecap="round"><path d="M45,45L5,5"></path><path d="M45,5L5,45"></path></svg>')
no-repeat center;
background-size: 0;
transition: all 0.3s;
}
.pickr .pcr-button::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>');
background-size: 0.5em;
border-radius: 0.15em;
z-index: -1;
}
.pickr .pcr-button::before {
z-index: initial;
}
.pickr .pcr-button::after {
position: absolute;
content: "";
top: 0;
left: 0;
height: 100%;
width: 100%;
transition: background 0.3s;
background: var(--pcr-color);
border-radius: 0.15em;
}
.pickr .pcr-button.clear {
background-size: 70%;
}
.pickr .pcr-button.clear::before {
opacity: 0;
}
.pickr .pcr-button.clear:focus {
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 0 3px var(--pcr-color);
}
.pickr .pcr-button.disabled {
cursor: not-allowed;
}
.pickr *,
.pcr-app * {
box-sizing: border-box;
outline: none;
border: none;
-webkit-appearance: none;
}
.pickr input:focus,
.pickr input.pcr-active,
.pickr button:focus,
.pickr button.pcr-active,
.pcr-app input:focus,
.pcr-app input.pcr-active,
.pcr-app button:focus,
.pcr-app button.pcr-active {
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 0 3px var(--pcr-color);
}
.pickr .pcr-palette,
.pickr .pcr-slider,
.pcr-app .pcr-palette,
.pcr-app .pcr-slider {
transition: box-shadow 0.3s;
}
.pickr .pcr-palette:focus,
.pickr .pcr-slider:focus,
.pcr-app .pcr-palette:focus,
.pcr-app .pcr-slider:focus {
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 0 3px rgba(0, 0, 0, 0.25);
}
.pcr-app {
position: fixed;
display: flex;
flex-direction: column;
z-index: 10000;
border-radius: 0.1em;
background: #fff;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s, visibility 0s 0.3s;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Helvetica Neue", Arial, sans-serif;
box-shadow: 0 0.15em 1.5em 0 rgba(0, 0, 0, 0.1), 0 0 1em 0 rgba(0, 0, 0, 0.03);
left: 0;
top: 0;
}
.pcr-app.visible {
transition: opacity 0.3s;
visibility: visible;
opacity: 1;
}
.pcr-app .pcr-swatches {
display: flex;
flex-wrap: wrap;
margin-top: 0.75em;
}
.pcr-app .pcr-swatches.pcr-last {
margin: 0;
}
@supports (display: grid) {
.pcr-app .pcr-swatches {
display: grid;
align-items: center;
grid-template-columns: repeat(auto-fit, 1.75em);
}
}
.pcr-app .pcr-swatches > button {
font-size: 1em;
position: relative;
width: calc(1.75em - 5px);
height: calc(1.75em - 5px);
border-radius: 0.15em;
cursor: pointer;
margin: 2.5px;
flex-shrink: 0;
justify-self: center;
transition: all 0.15s;
overflow: hidden;
background: transparent;
z-index: 1;
}
.pcr-app .pcr-swatches > button::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>');
background-size: 6px;
border-radius: 0.15em;
z-index: -1;
}
.pcr-app .pcr-swatches > button::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--pcr-color);
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 0.15em;
box-sizing: border-box;
}
.pcr-app .pcr-swatches > button:hover {
filter: brightness(1.05);
}
.pcr-app .pcr-swatches > button:not(.pcr-active) {
box-shadow: none;
}
.pcr-app .pcr-interaction {
display: flex;
flex-wrap: wrap;
align-items: center;
margin: 0 -0.2em 0 -0.2em;
}
.pcr-app .pcr-interaction > * {
margin: 0 0.2em;
}
.pcr-app .pcr-interaction input {
letter-spacing: 0.07em;
font-size: 0.75em;
text-align: center;
cursor: pointer;
color: #75797e;
background: #f1f3f4;
border-radius: 0.15em;
transition: all 0.15s;
padding: 0.45em 0.5em;
margin-top: 0.75em;
}
.pcr-app .pcr-interaction input:hover {
filter: brightness(0.975);
}
.pcr-app .pcr-interaction input:focus {
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85),
0 0 0 3px rgba(66, 133, 244, 0.75);
}
.pcr-app .pcr-interaction .pcr-result {
color: #75797e;
text-align: left;
flex: 1 1 8em;
min-width: 8em;
transition: all 0.2s;
border-radius: 0.15em;
background: #f1f3f4;
cursor: text;
}
.pcr-app .pcr-interaction .pcr-result::-moz-selection {
background: #4285f4;
color: #fff;
}
.pcr-app .pcr-interaction .pcr-result::selection {
background: #4285f4;
color: #fff;
}
.pcr-app .pcr-interaction .pcr-type.active {
color: #fff;
background: #4285f4;
}
.pcr-app .pcr-interaction .pcr-save,
.pcr-app .pcr-interaction .pcr-cancel,
.pcr-app .pcr-interaction .pcr-clear {
color: #fff;
width: auto;
}
.pcr-app .pcr-interaction .pcr-save,
.pcr-app .pcr-interaction .pcr-cancel,
.pcr-app .pcr-interaction .pcr-clear {
color: #fff;
}
.pcr-app .pcr-interaction .pcr-save:hover,
.pcr-app .pcr-interaction .pcr-cancel:hover,
.pcr-app .pcr-interaction .pcr-clear:hover {
filter: brightness(0.925);
}
.pcr-app .pcr-interaction .pcr-save {
background: #4285f4;
}
.pcr-app .pcr-interaction .pcr-clear,
.pcr-app .pcr-interaction .pcr-cancel {
background: #f44250;
}
.pcr-app .pcr-interaction .pcr-clear:focus,
.pcr-app .pcr-interaction .pcr-cancel:focus {
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85),
0 0 0 3px rgba(244, 66, 80, 0.75);
}
.pcr-app .pcr-selection .pcr-picker {
position: absolute;
height: 18px;
width: 18px;
border: 2px solid #fff;
border-radius: 100%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.pcr-app .pcr-selection .pcr-color-palette,
.pcr-app .pcr-selection .pcr-color-chooser,
.pcr-app .pcr-selection .pcr-color-opacity {
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
display: flex;
flex-direction: column;
cursor: grab;
cursor: -webkit-grab;
}
.pcr-app .pcr-selection .pcr-color-palette:active,
.pcr-app .pcr-selection .pcr-color-chooser:active,
.pcr-app .pcr-selection .pcr-color-opacity:active {
cursor: grabbing;
cursor: -webkit-grabbing;
}
.pcr-app[data-theme="nano"] {
width: 14.25em;
max-width: 95vw;
}
.pcr-app[data-theme="nano"] .pcr-swatches {
margin-top: 0.6em;
padding: 0 0.6em;
}
.pcr-app[data-theme="nano"] .pcr-interaction {
padding: 0 0.6em 0.6em 0.6em;
}
.pcr-app[data-theme="nano"] .pcr-selection {
display: grid;
grid-gap: 0.6em;
grid-template-columns: 1fr 4fr;
grid-template-rows: 5fr auto auto;
align-items: center;
height: 10.5em;
width: 100%;
align-self: flex-start;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-preview {
grid-area: 2 / 1 / 4 / 1;
height: 100%;
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
margin-left: 0.6em;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-preview .pcr-last-color {
display: none;
}
.pcr-app[data-theme="nano"]
.pcr-selection
.pcr-color-preview
.pcr-current-color {
position: relative;
background: var(--pcr-color);
width: 2em;
height: 2em;
border-radius: 50em;
overflow: hidden;
}
.pcr-app[data-theme="nano"]
.pcr-selection
.pcr-color-preview
.pcr-current-color::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>');
background-size: 0.5em;
border-radius: 0.15em;
z-index: -1;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-palette {
grid-area: 1 / 1 / 2 / 3;
width: 100%;
height: 100%;
z-index: 1;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-palette .pcr-palette {
border-radius: 0.15em;
width: 100%;
height: 100%;
}
.pcr-app[data-theme="nano"]
.pcr-selection
.pcr-color-palette
.pcr-palette::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>');
background-size: 0.5em;
border-radius: 0.15em;
z-index: -1;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-chooser {
grid-area: 2 / 2 / 2 / 2;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-opacity {
grid-area: 3 / 2 / 3 / 2;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-chooser,
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-opacity {
height: 0.5em;
margin: 0 0.6em;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-chooser .pcr-picker,
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-opacity .pcr-picker {
top: 50%;
transform: translateY(-50%);
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-chooser .pcr-slider,
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-opacity .pcr-slider {
flex-grow: 1;
border-radius: 50em;
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-chooser .pcr-slider {
background: linear-gradient(to right, red, #ff0, lime, cyan, blue, #f0f, red);
}
.pcr-app[data-theme="nano"] .pcr-selection .pcr-color-opacity .pcr-slider {
background: linear-gradient(to right, transparent, black),
url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><path fill="white" d="M1,0H2V1H1V0ZM0,1H1V2H0V1Z"/><path fill="gray" d="M0,0H1V1H0V0ZM1,1H2V2H1V1Z"/></svg>');
background-size: 100%, 0.25em;
}

22
.obsidian/plugins/iconic/data.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"biggerIcons": "mobile",
"clickableIcons": "desktop",
"showAllFileIcons": false,
"showAllFolderIcons": false,
"minimalFolderIcons": false,
"showItemName": "desktop",
"biggerSearchResults": "mobile",
"maxSearchResults": 50,
"colorPicker1": "list",
"colorPicker2": "rgb",
"uncolorHover": false,
"uncolorDrag": false,
"uncolorSelect": false,
"rememberDeletedItems": false,
"appIcons": {},
"tabIcons": {},
"fileIcons": {},
"bookmarkIcons": {},
"propertyIcons": {},
"ribbonIcons": {}
}

7
.obsidian/plugins/iconic/main.js vendored Normal file

File diff suppressed because one or more lines are too long

10
.obsidian/plugins/iconic/manifest.json vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"id": "iconic",
"name": "Iconic",
"version": "1.0.14",
"minAppVersion": "1.6.0",
"description": "Customize your app icons directly from the UI, including tabs, files, bookmarks, properties, and ribbon commands.",
"author": "Holo",
"authorUrl": "https://github.com/gfxholo",
"isDesktopOnly": false
}

324
.obsidian/plugins/iconic/styles.css vendored Normal file
View File

@@ -0,0 +1,324 @@
body {
--ltr-icons: .lucide-check, .lucide-help-circle, .sidebar-left, .sidebar-right;
}
.iconic-icon > .iconic-emoji {
display: flex;
flex-wrap: wrap;
align-content: center;
justify-content: center;
overflow: clip;
overflow-clip-margin: 5px;
width: var(--icon-size);
height: var(--icon-size);
font-size: calc(var(--icon-size) * 0.9);
}
/* Tabs */
.workspace .mod-root .workspace-tab-header[data-type="markdown"] .workspace-tab-header-inner-icon,
.workspace .mod-root .workspace-tab-header[data-type="empty"] .workspace-tab-header-inner-icon {
display: flex;
}
.workspace .mod-stacked .iconic-emoji {
transform: rotate(-90deg);
}
.iconic-bigger-icons .mod-root .workspace-tab-header-inner-icon.iconic-icon > * {
--icon-size: var(--icon-s);
--icon-stroke: var(--icon-s-stroke-width);
}
.iconic-clickable-icons .mod-root .workspace-tab-header-inner-icon.iconic-icon:hover {
cursor: pointer;
filter: contrast(200%);
}
/* List items */
.tree-item-self > .iconic-icon > .iconic-emoji {
--icon-size: var(--icon-xs);
}
.tree-item-self > .tree-item-icon.collapse-icon.iconic-icon > .svg-icon {
width: var(--icon-size);
height: var(--icon-size);
stroke-width: var(--icon-stroke);
color: unset;
transform: unset;
}
.mod-rtl .tree-item-self > .tree-item-icon.collapse-icon.iconic-icon > .svg-icon:not(var(--ltr-icons)) {
transform: scale(-1, 1);
}
.tree-item-self > .iconic-sidekick {
display: flex;
align-self: center;
width: var(--size-4-4);
margin-inline-end: var(--size-4-1);
opacity: var(--icon-opacity);
--icon-size: var(--icon-xs);
--icon-stroke: var(--icon-s-stroke-width);
}
.iconic-bigger-icons .tree-item-self > .iconic-icon > .svg-icon {
--icon-size: var(--icon-s);
--icon-stroke: var(--icon-s-stroke-width);
}
.iconic-bigger-icons .tree-item-self > .iconic-icon > .iconic-emoji {
--icon-size: var(--icon-s);
}
.iconic-bigger-icons .iconic-item > .tree-item-self > .tree-item-inner {
margin-inline-start: 1.5px;
}
.is-mobile .iconic-bigger-icons .tree-item.iconic-item > .tree-item-self > .tree-item-inner {
margin-inline-start: 3px;
}
.iconic-clickable-icons .tree-item-self > .iconic-icon:hover {
cursor: pointer;
filter: contrast(200%);
}
/* Properties editor */
.iconic-clickable-icons .metadata-property-icon.iconic-icon:hover {
cursor: pointer;
filter: contrast(200%);
}
/* Ribbon */
.side-dock-ribbon-action.iconic-icon > .iconic-emoji {
--icon-size: var(--icon-l);
}
.mobile-option-setting-item-option-icon.iconic-icon {
cursor: pointer;
}
/* Icon picker */
.iconic-modal .setting-item-control input[type="color"] { width: auto; }
.iconic-modal .setting-item-control input[type="text"] { width: 100%; }
.iconic-modal .setting-item-control .search-input-container { width: 100%; }
.is-mobile .iconic-button-row {
display: flex;
flex-direction: row;
gap: var(--size-4-3);
}
.is-phone .iconic-button-row > button {
width: 100%;
}
.is-tablet .iconic-button-row > button:not(.mod-destructive) {
margin-inline-start: auto;
}
/* Search results container */
.iconic-search-results { overflow-x: scroll; }
.iconic-search-results > .setting-item-info { display: none; }
.iconic-search-results > .setting-item-control { justify-content: center; }
.is-phone .iconic-search-results { flex-direction: row !important; }
.is-phone .iconic-search-results > .setting-item-control { width: auto !important; }
/* Search result */
.iconic-search-result > * {
height: var(--icon-size);
--icon-size: calc(var(--icon-l) * 1.25);
--icon-stroke: calc(var(--icon-l-stroke-width) * 6/7);
}
.iconic-bigger-search-results .iconic-search-result > * {
--icon-size: var(--icon-xl);
--icon-stroke: var(--icon-xl-stroke-width);
}
.is-mobile .iconic-search-result > * {
--icon-size: var(--icon-l);
--icon-stroke: var(--icon-l-stroke-width);
}
.is-mobile.iconic-bigger-search-results .iconic-search-result > * {
--icon-size: var(--icon-xl);
--icon-stroke: var(--icon-l-stroke-width);
}
/* Indicators */
.iconic-indicator { pointer-events: none; }
/* Invisibility */
.iconic-invisible { visibility: hidden; }
.is-phone .iconic-reset-color.iconic-invisible { display: none; }
/* Colorless settings */
.iconic-uncolor-hover .workspace-tab-header:hover .iconic-icon > .svg-icon,
.iconic-uncolor-hover .tree-item-self:hover > .tree-item-icon.iconic-icon > .svg-icon,
.iconic-uncolor-hover .side-dock-ribbon-action.iconic-icon:hover > .svg-icon,
.iconic-uncolor-hover .iconic-search-result:hover > .svg-icon {
color: currentColor !important;
}
.iconic-uncolor-drag > .drag-ghost .svg-icon {
color: currentColor !important;
}
.iconic-uncolor-select .workspace-tab-header.is-active .iconic-icon > .svg-icon,
.iconic-uncolor-select .tree-item-self.is-active > .tree-item-icon.iconic-icon > .svg-icon {
color: currentColor !important;
}
/* Theme: Blue Topaz */
.iconic-theme-btopaz .workspace-leaf-content[data-type="file-explorer"] .tree-item-icon:not(.collapse-icon) {
margin-inline-start: 0;
}
.iconic-theme-btopaz .workspace-leaf-content[data-type="file-explorer"] .nav-file-title-content {
margin-inline-start: var(--size-4-5);
}
.iconic-theme-btopaz .workspace-leaf-content[data-type="file-explorer"] .nav-file-title .nav-file-title-content:not(.mk-tree-text)::before {
display: none;
}
.iconic-theme-btopaz .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title:has(.collapse-icon.iconic-icon) > .collapse-icon::before {
display: none;
}
.iconic-theme-btopaz .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title:has(.collapse-icon.iconic-icon) > .collapse-icon > svg {
display: flex;
}
/* Theme: Border */
.iconic-theme-border .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .nav-file-title::before {
display: none;
}
.iconic-theme-border .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .tree-item > .tree-item-self.mod-collapsible > .collapse-icon {
-webkit-mask-image: none;
background-color: transparent;
}
.iconic-theme-border .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .tree-item-self.mod-collapsible > .collapse-icon > .svg-icon {
color: unset;
}
.iconic-theme-border .workspace-leaf-content[data-type="file-explorer"] .tree-item > .tree-item-self:is(.nav-file-title, .nav-folder.mod-root > .nav-folder-title)::before {
display: none;
}
/* Theme: Catppuccin */
.iconic-theme-cat .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title-content::before {
display: none;
}
/* Theme: Cyber Glow */
.iconic-theme-cglow .workspace-leaf-content[data-type="file-explorer"] .tree-item-self > .tree-item-inner::before {
display: none;
}
.iconic-theme-cglow .workspace-leaf-content[data-type="file-explorer"] .tree-item-icon.collapse-icon.nav-folder-collapse-indicator {
display: flex;
}
/* Theme: Discordian */
.iconic-theme-discord .workspace-leaf-content[data-type="file-explorer"] .nav-file-title > .tree-item-icon {
margin-inline-start: 0;
}
.iconic-theme-discord .workspace-leaf-content[data-type="file-explorer"] .nav-file-title-content {
margin-inline-start: var(--size-4-5);
}
/* Theme: ITS Theme */
.iconic-theme-its .tree-item-self > .tree-item-icon {
margin-right: 6px;
}
.iconic-theme-its .workspace-leaf-content[data-type="file-explorer"] .tree-item-icon {
position: absolute;
}
.iconic-theme-its .workspace-leaf-content[data-type="file-explorer"] .nav-file-title-content {
margin-inline-start: var(--size-4-5);
}
.iconic-theme-its .workspace-leaf-content[data-type="file-explorer"] .nav-file-title-content::before,
.iconic-theme-its .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title-content::before {
display: none;
}
.iconic-theme-its .workspace-leaf-content[data-type="file-explorer"] .nav-folder-collapse-indicator {
display: flex;
}
.iconic-theme-its .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title:not(:has(.iconic-sidekick)) > .nav-folder-title-content {
margin-inline-start: var(--size-4-5);
}
.iconic-theme-its .workspace-leaf-content[data-type="file-explorer"] .iconic-sidekick {
margin-inline-start: var(--size-4-5);
}
/* Theme: LYT Mode */
.iconic-theme-lyt .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .tree-item-inner {
padding-inline-start: var(--size-4-2);
}
.iconic-theme-lyt .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .iconic-sidekick {
margin-inline-start: var(--size-4-2);
margin-inline-end: 0;
}
.iconic-theme-lyt .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .tree-item-icon:not(.collapse-icon) {
margin-inline-start: calc(-0.5 * var(--size-4-5));
}
.iconic-theme-lyt .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .mod-collapsible:not(:has(.iconic-sidekick)) > .tree-item-inner {
padding-inline-start: var(--size-4-2);
margin-inline-start: var(--size-4-2);
}
.iconic-theme-lyt .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) :not(.mod-collapsible) > .tree-item-inner {
margin-inline-start: var(--size-4-2);
}
.iconic-theme-lyt .workspace-leaf-content > :is(.nav-files-container, .view-content).node-insert-event {
padding: var(--size-4-1) var(--size-4-3) var(--size-4-6) var(--size-4-3);
}
/* Theme: Mado Miniflow */
.iconic-theme-mflow .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .tree-item:not(.mod-collapsible) {
margin-inline-start: var(--size-4-2);
}
.iconic-theme-mflow .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title > .collapse-icon {
display: flex;
}
/* Theme: Sanctum */
.iconic-theme-sanctum .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title:has(.iconic-sidekick) > .nav-folder-title-content::before {
display: none;
}
/* Theme: Shiba Inu */
.iconic-theme-shiba.theme-light:not(.default-light-theme, .lily-light, .ivory-light, .sky-light, .stone-light) {
--color-red: rgb(240, 68, 114);
--color-orange: rgb(249, 102, 50);
--color-yellow: rgb(228, 147, 32);
--color-green: rgb(64, 155, 40);
--color-cyan: rgb(23, 146, 153);
--color-blue: rgb(71, 143, 238);
--color-purple: rgb(176, 110, 201);
--color-pink: rgb(215, 125, 146);
}
.iconic-theme-shiba.theme-dark:not(.default-dark-theme, .Lilac-dark, .pure-dark, .warm-dark) {
--color-red: rgb(255, 98, 107);
--color-orange: rgb(247, 157, 124);
--color-yellow: rgb(249, 226, 175);
--color-green: rgb(56, 198, 141);
--color-cyan: rgb(104, 188, 204);
--color-blue: rgb(147, 183, 245);
--color-purple: rgb(196, 167, 231);
--color-pink: rgb(243, 137, 143);
}
.iconic-theme-shiba .workspace-leaf-content[data-type="file-explorer"] .nav-file-title-content::before {
display: none;
}
/* Theme: Shimmering Focus */
.iconic-theme-shimmer :is(.style-settings-collapse-indicator, .collapse-icon) > .svg-icon.svg-icon.svg-icon.svg-icon {
width: var(--icon-xs);
stroke-width: var(--icon-xs-stroke-width);
height: unset;
margin-left: unset;
}
.iconic-theme-shimmer.iconic-bigger-icons :is(.style-settings-collapse-indicator, .collapse-icon) > .svg-icon.svg-icon.svg-icon.svg-icon {
width: var(--icon-s);
stroke-width: var(--icon-s-stroke-width);
}
/* Theme: Sodalite */
.iconic-theme-sodalite .workspace-leaf-content[data-type="file-explorer"] .nav-files-container {
padding-inline-start: var(--size-4-3);
padding-inline-end: var(--size-4-3);
}
.iconic-theme-sodalite .workspace-leaf-content[data-type="file-explorer"] .tree-item-inner::before {
display: none;
}
/* Theme: Spectrum */
.iconic-theme-spectrum .workspace-leaf-content[data-type="file-explorer"] .nav-folder-title > .nav-folder-title-content::before {
display: none;
}
/* Theme: Terminal */
.iconic-theme-terminal .workspace-leaf-content:is([data-type="file-explorer"], [data-type="bookmarks"]) .collapse-icon.iconic-icon::before {
display: none;
}
/* Theme: Ukiyo */
.iconic-theme-ukiyo .workspace-leaf > .workspace-leaf-content[data-type="file-explorer"] > .nav-files-container.node-insert-event {
padding: var(--size-4-1) var(--size-4-3) var(--size-4-6) var(--size-4-3);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-banners",
"name": "Banners",
"description": "Add banner images to your notes!",
"version": "1.3.3",
"minAppVersion": "0.13.21",
"author": "Danny Hernandez",
"authorUrl": "https://github.com/noatpad",
"isDesktopOnly": false
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
-- credits to tarleb — StackExchange: https://tex.stackexchange.com/questions/392070/pandoc-markdown-create-self-contained-bib-file-from-cited-references
function Pandoc(d)
d.meta.references = pandoc.utils.references(d)
d.meta.bibliography = nil
return d
end

View File

@@ -0,0 +1,5 @@
package.path=package.path..";" ..debug.getinfo(1).source:match("(.*[/\\])"):sub(2) .. "?.lua"
Mode='hugo'
require('markdown')

View File

@@ -0,0 +1,237 @@
package.path=debug.getinfo(1).source:gsub('@',''):sub(0):match('(.*[/\\])'):sub(0) .. '?.lua' .. ';' .. package.path
require("polyfill")
local url = require('url')
local pandoc=pandoc
local PANDOC_STATE=PANDOC_STATE
PANDOC_VERSION:must_be_at_least '3.1.7'
os.text = pandoc.text
local PATH = pandoc.path
local doc_dir = nil
local media_dir = nil
if Mode == nil then
Mode = 'default'
end
-- print("Mode: "..Mode)
if PANDOC_STATE.output_file then
local output_file = PANDOC_STATE.output_file
doc_dir = PATH.directory(output_file)
if PANDOC_WRITER_OPTIONS.variables["media_dir"] then
media_dir = tostring(PANDOC_WRITER_OPTIONS.variables["media_dir"])
else
media_dir = PATH.split_extension(output_file)
if Mode ~= 'hugo' then
media_dir = media_dir .. '-media'
end
end
end
assert(doc_dir, "doc_dir is nil")
assert(media_dir, "media_dir is nil")
local function get_absolute_path(file_path)
if PATH.is_absolute(file_path) then
return file_path
end
for _, dir in pairs(PANDOC_STATE.resource_path) do
local full_path = PATH.join({dir, file_path})
if os.exists(full_path) then
return full_path
end
end
for _, file in pairs(PANDOC_STATE.input_files) do
if not PATH.is_absolute(file) then
file = PATH.join({pandoc.system.get_working_directory(), file_path})
end
local dir = PATH.directory(file)
local full_path = PATH.join({dir, file_path})
if os.exists(full_path) then
return full_path
end
end
return nil
end
local function get_output_file(file_path)
if media_dir then
local new_file_name = pandoc.utils.sha1(file_path)
local _, new_file_ext = PATH.split_extension(file_path)
file_path = new_file_name .. new_file_ext
local full_path = PATH.join({media_dir, file_path})
return full_path
else
return nil
end
end
local function extract_media(file_path)
os.mkdir(media_dir)
file_path = url.decode(file_path)
local abs_path = get_absolute_path(file_path)
local file = get_output_file(file_path)
if abs_path and file then
if not os.exists(file) then
os.copy(abs_path, file)
end
local rel_path = PATH.make_relative(file, doc_dir, false)
local parts = PATH.split(rel_path)
for i,v in ipairs(parts) do
parts[i] = url.encode(v)
end
local encoded_rel_path = table.concat(parts, "/")
if Mode == 'hugo' then
encoded_rel_path = '../' .. encoded_rel_path
end
return encoded_rel_path
end
end
local function raw(s)
return pandoc.RawInline('markdown', s)
end
function Image(el)
local src = extract_media(el.src)
if src then
el.src = src
end
return el
end
function Space()
return raw(' ')
end
function SoftBreak()
return raw('\n')
end
function RawInline(el)
if el.format == "html" then
el.format = 'markdown'
el.text = string.gsub(el.text, '<img[^>]+>', function(img)
return string.gsub(img, 'src="([^"]+)"', function(url)
if string.find(url, '^[Hh][Tt][Tt][Pp][Ss]?://') == nil then
local extract_media_url = extract_media(url)
if extract_media_url then
return 'src="' .. extract_media_url .. '"'
end
return '123'
end
return 'src="' .. url .. '"'
end)
end)
end
return el
end
function RawBlock(el)
if el.format == "html" then
el.format = 'markdown'
end
return el
end
function Math(el)
if Mode == 'hugo' then
if el.mathtype == 'DisplayMath' then
return raw('{{< mathjax >}}\n$$' .. el.text .. '$$\n{{</mathjax >}}')
else
el.text = string.gsub(el.text, '\\[\\{\\}]', function (v)
return '\\' .. v
end)
el.text = string.gsub(el.text, '_', function (v)
return '\\' .. v
end)
end
end
return el
end
local function headerLink(input)
-- github style section link
return "#"..input:gsub(' ', '-')
end
local function insertLink(content, linkDescription)
local descriptionText = table.concat(linkDescription, "")
if string.find(descriptionText, '|') then
local target, desc = descriptionText:match("(.*)|(.*)")
table.insert(content, pandoc.Link(desc, headerLink(target)))
else
table.insert(content, pandoc.Link(descriptionText, headerLink(descriptionText)))
end
end
function Para(el)
local content = el.content
content = ProcessMath(content)
content = ProcessInternalLinks(content)
el.content = content
return el
end
function ProcessMath(elements)
local content = {}
local in_display_math = false
for _, item in pairs(elements) do
if item.t == 'Str'and item.text == "$$" then
in_display_math = not in_display_math
else
if in_display_math then
if item.t == 'RawInline' and item.format == 'tex' then
local n = pandoc.Math('DisplayMath', '\n' .. item.text .. '\n')
table.insert(content, Math(n))
else
table.insert(content, item)
end
else
table.insert(content, item)
end
end
end
return content
end
function ProcessInternalLinks(elements)
local content = {}
local in_section_link = false
local linkDescription = {}
for _, item in pairs(elements) do
if item.t == 'Str' and string.starts_with(item.text, '[[#') then
in_section_link = true
table.insert(linkDescription, string.sub(item.text, 4))
elseif in_section_link then
if string.ends_with(item.text, ']]') then
table.insert(linkDescription, string.sub(item.text, 1, -3))
insertLink(content, linkDescription)
in_section_link = false
linkDescription = {}
else
table.insert(linkDescription, item.text)
end
else
table.insert(content, item)
end
end
return content
end
function Plain(el)
el.content = ProcessInternalLinks(el.content)
return el
end
function Pandoc(el)
return el
end

View File

@@ -0,0 +1,68 @@
traverse = 'topdown'
math_block_text = nil
function process(el)
-- MathBlock start or end
if el.t == 'Str' and el.text == '$$' then
if math_block_text == nil then -- start
math_block_text = ''
else -- end
local math_block = pandoc.Math('DisplayMath', '\n' .. math_block_text .. '\n')
math_block_text = nil
return math_block
end
return {}
end
if math_block_text then
if (el.t == 'RawInline' or el.t == 'RawBlock') and el.format == 'tex' then
math_block_text = math_block_text .. el.text
return {}
elseif el.t == 'Str' then
math_block_text = math_block_text .. el.text
return {}
elseif el.t == 'SoftBreak' or el.t == 'BulletList' then
return {}
end
end
return el
end
function RawInline(el)
return process(el)
end
function RawBlock(el)
return process(el)
end
function Str(el)
return process(el)
end
function SoftBreak(el)
return process(el)
end
function Header(el)
return process(el)
end
function Para(el)
return process(el)
end
function Plain(el)
return process(el)
end
function BulletList(el)
return process(el)
end

View File

@@ -0,0 +1,12 @@
return {
{
Math = function (elem)
if elem.text:find("^%s*\\begin{") ~= nil then
return pandoc.RawInline('tex', elem.text)
else
return elem
end
end,
}
}

View File

@@ -0,0 +1,61 @@
os.platform = nil
if os.platform == nil then
local libExt = package.cpath:match("%p[\\|/]?\\.%p(%a+)")
if libExt == 'dll' then
os.platform = "Windows"
elseif libExt == 'so' then
os.platform = "Linux"
elseif libExt == 'dylib' then
os.platform = "MacOS"
end
end
os.copy = function(src, dest)
if os.platform == "Windows" then
src = string.gsub(src, "/", "\\")
src = os.text.toencoding(src)
dest = os.text.toencoding(dest)
os.execute('copy "' .. src .. '" "' .. dest .. '" >NUL')
else
os.execute('cp "' .. src .. '" "' .. dest .. '"')
end
end
os.mkdir = function(dir)
if os.exists(dir) then
return
end
if os.platform == "Windows" then
dir = os.text.toencoding(dir)
os.execute('mkdir "' .. dir .. '"')
else
os.execute('mkdir -p "' .. dir .. '"')
end
end
os.exists = function(path)
if os.platform == "Windows" then
path = string.gsub(path, "/", "\\")
path = os.text.toencoding(path)
local _, _, code = os.execute('if exist "' .. path .. '" (exit 0) else (exit 1)')
return code == 0
else
local _, _, code = os.execute('test -e "' .. path .. '"')
return code == 0
end
end
string.starts_with = function(str, start)
return str:sub(1, #start) == start
end
string.ends_with = function(str, ending)
return ending == "" or str:sub(-#ending) == ending
end
return {
os = os,
string = string
}

View File

@@ -0,0 +1,18 @@
local function encode (str)
str = string.gsub (str, "([^0-9a-zA-Z !'()*._~-])", -- locale independent
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "%%20")
return str
end
local function decode (str)
str = string.gsub (str, "%%20", " ")
str = string.gsub (str, "%%(%x%x)", function(h) return string.char(tonumber(h,16)) end)
return str
end
return {
encode = encode,
decode = decode
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-enhancing-export",
"name": "Enhancing Export",
"version": "1.10.8",
"minAppVersion": "1.6.3",
"description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.",
"author": "YISH",
"authorUrl": "https://github.com/mokeyish",
"isDesktopOnly": true
}

View File

@@ -0,0 +1 @@
.setting-item.ex-setting-item{border-top:unset;padding-top:0}*[hidden]{display:none}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,373 @@
% partial rewrite of the LaTeX2e package for submissions to the
% Conference on Neural Information Processing Systems (NeurIPS):
%
% - uses more LaTeX conventions
% - line numbers at submission time replaced with aligned numbers from
% lineno package
% - \nipsfinalcopy replaced with [final] package option
% - automatically loads times package for authors
% - loads natbib automatically; this can be suppressed with the
% [nonatbib] package option
% - adds foot line to first page identifying the conference
% - adds preprint option for submission to e.g. arXiv
% - conference acronym modified
%
% Roman Garnett (garnett@wustl.edu) and the many authors of
% nips15submit_e.sty, including MK and drstrip@sandia
%
% last revision: March 2023
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{neurips}[2023/03/31 NeurIPS 2023 submission/camera-ready style file]
% declare final option, which creates camera-ready copy
\newif\if@neuripsfinal\@neuripsfinalfalse
\DeclareOption{final}{
\@neuripsfinaltrue
}
% declare nonatbib option, which does not load natbib in case of
% package clash (users can pass options to natbib via
% \PassOptionsToPackage)
\newif\if@natbib\@natbibtrue
\DeclareOption{nonatbib}{
\@natbibfalse
}
% declare preprint option, which creates a preprint version ready for
% upload to, e.g., arXiv
\newif\if@preprint\@preprintfalse
\DeclareOption{preprint}{
\@preprinttrue
}
\ProcessOptions\relax
% determine whether this is an anonymized submission
\newif\if@submission\@submissiontrue
\if@neuripsfinal\@submissionfalse\fi
\if@preprint\@submissionfalse\fi
% fonts
\renewcommand{\rmdefault}{ptm}
\renewcommand{\sfdefault}{phv}
% change this every year for notice string at bottom
\newcommand{\@neuripsordinal}{}
\newcommand{\@neuripsyear}{\the\year}
\newcommand{\@neuripslocation}{}
% acknowledgments
\usepackage{environ}
\newcommand{\acksection}{\section*{Acknowledgments and Disclosure of Funding}}
\NewEnviron{ack}{%
\acksection
\BODY
}
% load natbib unless told otherwise
\if@natbib
\RequirePackage{natbib}
\fi
% set page geometry
\usepackage[verbose=true,letterpaper]{geometry}
\AtBeginDocument{
\newgeometry{
textheight=9in,
textwidth=5.5in,
top=1in,
headheight=12pt,
headsep=25pt,
footskip=30pt
}
\@ifpackageloaded{fullpage}
{\PackageWarning{neurips_2023}{fullpage package not allowed! Overwriting formatting.}}
{}
}
\widowpenalty=10000
\clubpenalty=10000
\flushbottom
\sloppy
% font sizes with reduced leading
\renewcommand{\normalsize}{%
\@setfontsize\normalsize\@xpt\@xipt
\abovedisplayskip 7\p@ \@plus 2\p@ \@minus 5\p@
\abovedisplayshortskip \z@ \@plus 3\p@
\belowdisplayskip \abovedisplayskip
\belowdisplayshortskip 4\p@ \@plus 3\p@ \@minus 3\p@
}
\normalsize
\renewcommand{\small}{%
\@setfontsize\small\@ixpt\@xpt
\abovedisplayskip 6\p@ \@plus 1.5\p@ \@minus 4\p@
\abovedisplayshortskip \z@ \@plus 2\p@
\belowdisplayskip \abovedisplayskip
\belowdisplayshortskip 3\p@ \@plus 2\p@ \@minus 2\p@
}
\renewcommand{\footnotesize}{\@setfontsize\footnotesize\@ixpt\@xpt}
\renewcommand{\scriptsize}{\@setfontsize\scriptsize\@viipt\@viiipt}
\renewcommand{\tiny}{\@setfontsize\tiny\@vipt\@viipt}
\renewcommand{\large}{\@setfontsize\large\@xiipt{14}}
\renewcommand{\Large}{\@setfontsize\Large\@xivpt{16}}
\renewcommand{\LARGE}{\@setfontsize\LARGE\@xviipt{20}}
\renewcommand{\huge}{\@setfontsize\huge\@xxpt{23}}
\renewcommand{\Huge}{\@setfontsize\Huge\@xxvpt{28}}
% sections with less space
\providecommand{\section}{}
\renewcommand{\section}{%
\@startsection{section}{1}{\z@}%
{-2.0ex \@plus -0.5ex \@minus -0.2ex}%
{ 1.5ex \@plus 0.3ex \@minus 0.2ex}%
{\large\bf\raggedright}%
}
\providecommand{\subsection}{}
\renewcommand{\subsection}{%
\@startsection{subsection}{2}{\z@}%
{-1.8ex \@plus -0.5ex \@minus -0.2ex}%
{ 0.8ex \@plus 0.2ex}%
{\normalsize\bf\raggedright}%
}
\providecommand{\subsubsection}{}
\renewcommand{\subsubsection}{%
\@startsection{subsubsection}{3}{\z@}%
{-1.5ex \@plus -0.5ex \@minus -0.2ex}%
{ 0.5ex \@plus 0.2ex}%
{\normalsize\bf\raggedright}%
}
\providecommand{\paragraph}{}
\renewcommand{\paragraph}{%
\@startsection{paragraph}{4}{\z@}%
{1.5ex \@plus 0.5ex \@minus 0.2ex}%
{-1em}%
{\normalsize\bf}%
}
\providecommand{\subparagraph}{}
\renewcommand{\subparagraph}{%
\@startsection{subparagraph}{5}{\z@}%
{1.5ex \@plus 0.5ex \@minus 0.2ex}%
{-1em}%
{\normalsize\bf}%
}
\providecommand{\subsubsubsection}{}
\renewcommand{\subsubsubsection}{%
\vskip5pt{\noindent\normalsize\rm\raggedright}%
}
% float placement
\renewcommand{\topfraction }{0.85}
\renewcommand{\bottomfraction }{0.4}
\renewcommand{\textfraction }{0.1}
\renewcommand{\floatpagefraction}{0.7}
\newlength{\@neuripsabovecaptionskip}\setlength{\@neuripsabovecaptionskip}{7\p@}
\newlength{\@neuripsbelowcaptionskip}\setlength{\@neuripsbelowcaptionskip}{\z@}
\setlength{\abovecaptionskip}{\@neuripsabovecaptionskip}
\setlength{\belowcaptionskip}{\@neuripsbelowcaptionskip}
% swap above/belowcaptionskip lengths for tables
\renewenvironment{table}
{\setlength{\abovecaptionskip}{\@neuripsbelowcaptionskip}%
\setlength{\belowcaptionskip}{\@neuripsabovecaptionskip}%
\@float{table}}
{\end@float}
% footnote formatting
\setlength{\footnotesep }{6.65\p@}
\setlength{\skip\footins}{9\p@ \@plus 4\p@ \@minus 2\p@}
\renewcommand{\footnoterule}{\kern-3\p@ \hrule width 12pc \kern 2.6\p@}
\setcounter{footnote}{0}
% paragraph formatting
\setlength{\parindent}{\z@}
\setlength{\parskip }{5.5\p@}
% list formatting
\setlength{\topsep }{4\p@ \@plus 1\p@ \@minus 2\p@}
\setlength{\partopsep }{1\p@ \@plus 0.5\p@ \@minus 0.5\p@}
\setlength{\itemsep }{2\p@ \@plus 1\p@ \@minus 0.5\p@}
\setlength{\parsep }{2\p@ \@plus 1\p@ \@minus 0.5\p@}
\setlength{\leftmargin }{3pc}
\setlength{\leftmargini }{\leftmargin}
\setlength{\leftmarginii }{2em}
\setlength{\leftmarginiii}{1.5em}
\setlength{\leftmarginiv }{1.0em}
\setlength{\leftmarginv }{0.5em}
\def\@listi {\leftmargin\leftmargini}
\def\@listii {\leftmargin\leftmarginii
\labelwidth\leftmarginii
\advance\labelwidth-\labelsep
\topsep 2\p@ \@plus 1\p@ \@minus 0.5\p@
\parsep 1\p@ \@plus 0.5\p@ \@minus 0.5\p@
\itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii
\advance\labelwidth-\labelsep
\topsep 1\p@ \@plus 0.5\p@ \@minus 0.5\p@
\parsep \z@
\partopsep 0.5\p@ \@plus 0\p@ \@minus 0.5\p@
\itemsep \topsep}
\def\@listiv {\leftmargin\leftmarginiv
\labelwidth\leftmarginiv
\advance\labelwidth-\labelsep}
\def\@listv {\leftmargin\leftmarginv
\labelwidth\leftmarginv
\advance\labelwidth-\labelsep}
\def\@listvi {\leftmargin\leftmarginvi
\labelwidth\leftmarginvi
\advance\labelwidth-\labelsep}
% create title
\providecommand{\maketitle}{}
\renewcommand{\maketitle}{%
\par
\begingroup
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
% for perfect author name centering
\renewcommand{\@makefnmark}{\hbox to \z@{$^{\@thefnmark}$\hss}}
% The footnote-mark was overlapping the footnote-text,
% added the following to fix this problem (MK)
\long\def\@makefntext##1{%
\parindent 1em\noindent
\hbox to 1.8em{\hss $\m@th ^{\@thefnmark}$}##1
}
\thispagestyle{empty}
\@maketitle
\@thanks
\@notice
\endgroup
\let\maketitle\relax
\let\thanks\relax
}
% rules for title box at top of first page
\newcommand{\@toptitlebar}{
\hrule height 4\p@
\vskip 0.25in
\vskip -\parskip%
}
\newcommand{\@bottomtitlebar}{
\vskip 0.29in
\vskip -\parskip
\hrule height 1\p@
\vskip 0.09in%
}
% create title (includes both anonymized and non-anonymized versions)
\providecommand{\@maketitle}{}
\renewcommand{\@maketitle}{%
\vbox{%
\hsize\textwidth
\linewidth\hsize
\vskip 0.1in
\@toptitlebar
\centering
{\LARGE\bf \@title\par}
\@bottomtitlebar
\if@submission
\begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}
Anonymous Author(s) \\
Affiliation \\
Address \\
\texttt{email} \\
\end{tabular}%
\else
\def\And{%
\end{tabular}\hfil\linebreak[0]\hfil%
\begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\ignorespaces%
}
\def\AND{%
\end{tabular}\hfil\linebreak[4]\hfil%
\begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\ignorespaces%
}
\begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\@author\end{tabular}%
\fi
\vskip 0.3in \@minus 0.1in
}
}
% add conference notice to bottom of first page
\newcommand{\ftype@noticebox}{8}
\newcommand{\@notice}{%
% give a bit of extra room back to authors on first page
\enlargethispage{2\baselineskip}%
\@float{noticebox}[b]%
\footnotesize\@noticestring%
\end@float%
}
% abstract styling
\renewenvironment{abstract}%
{%
\vskip 0.075in%
\centerline%
{\large\bf Abstract}%
\vspace{0.5ex}%
\begin{quote}%
}
{
\par%
\end{quote}%
\vskip 1ex%
}
% handle tweaks for camera-ready copy vs. submission copy
\if@preprint
\newcommand{\@noticestring}{%
Preprint. Under review.%
}
\else
\if@neuripsfinal
\newcommand{\@noticestring}{%
(\@neuripsyear) \@title
}
\else
\newcommand{\@noticestring}{%
(\@neuripsyear) \@title %
}
% hide the acknowledgements
\NewEnviron{hide}{}
\let\ack\hide
\let\endack\endhide
% line numbers for submission
\RequirePackage{lineno}
\linenumbers
% fix incompatibilities between lineno and amsmath, if required, by
% transparently wrapping linenomath environments around amsmath
% environments
\AtBeginDocument{%
\@ifpackageloaded{amsmath}{%
\newcommand*\patchAmsMathEnvironmentForLineno[1]{%
\expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
\renewenvironment{#1}%
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}%
}%
\newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{%
\patchAmsMathEnvironmentForLineno{#1}%
\patchAmsMathEnvironmentForLineno{#1*}%
}%
\patchBothAmsMathEnvironmentsForLineno{equation}%
\patchBothAmsMathEnvironmentsForLineno{align}%
\patchBothAmsMathEnvironmentsForLineno{flalign}%
\patchBothAmsMathEnvironmentsForLineno{alignat}%
\patchBothAmsMathEnvironmentsForLineno{gather}%
\patchBothAmsMathEnvironmentsForLineno{multline}%
}
{}
}
\fi
\fi
\endinput

View File

@@ -0,0 +1,182 @@
% This template was tested with Pandoc 3.4 and pandoc-crossref v0.3.18.0. It should be backwards compatible with older version of pandoc..
\documentclass{article}
% if you need to pass options to natbib, use, e.g.:
% \PassOptionsToPackage{numbers, compress}{natbib}
% before loading neurips_2023
% ready for submission
\usepackage[final,nonatbib]{neurips}
% to compile a preprint version, e.g., for submission to arXiv, add add the
% [preprint] option:
% \usepackage[preprint]{neurips_2023}
% to compile a camera-ready version, add the [final] option, e.g.:
% \usepackage[final]{neurips_2023}
% to avoid loading the natbib package, add option nonatbib:
% \usepackage[nonatbib]{neurips_2023}
\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc} % use 8-bit T1 fonts
\usepackage{hyperref} % hyperlinks
\usepackage{url} % simple URL typesetting
\usepackage{booktabs} % professional-quality tables
\usepackage{amsfonts} % blackboard math symbols
\usepackage{nicefrac} % compact symbols for 1/2, etc.
\usepackage{microtype} % microtypography
\usepackage{xcolor} % colors
\usepackage{graphicx}
\makeatletter
\newsavebox\pandoc@box
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
\sbox\pandoc@box{#1}%
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
\else\usebox{\pandoc@box}%
\fi%
}
\makeatother
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
$if(csl-refs)$
% definitions for citeproc citations
\NewDocumentCommand\citeproctext{}{}
\NewDocumentCommand\citeproc{mm}{%
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
\makeatletter
% allow citations to break across lines
\let\@cite@ofmt\@firstofone
% avoid brackets around text for \cite:
\def\@biblabel#1{}
\def\@cite#1#2{{#1\if@tempswa , #2\fi}}
\makeatother
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing
{\begin{list}{}{%
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{0pt}
\setlength{\parsep}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\setlength{\leftmargin}{\cslhangindent}
\setlength{\itemindent}{-1\cslhangindent}
\fi
% set entry spacing
\setlength{\itemsep}{#2\baselineskip}}}
{\end{list}}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\title{$title$}
% Iterate through the authors except last to add \And.
\author{%
$for(authors/allbutlast)$
$authors.name$\\$authors.affiliation$\\$authors.institution$\\$authors.email$\\$authors.address$ \And
$endfor$
$for(authors/last)$
$authors.name$\\$authors.affiliation$\\$authors.institution$\\$authors.email$\\$authors.address$
$endfor$
}
% \author{%
% David S.~Hippocampus \\
% Department of Computer Science\\
% Cranberry-Lemon University\\
% Pittsburgh, PA 15213 \\
% \texttt{hippo@cs.cranberry-lemon.edu} \\
% % examples of more authors
% % \And
% % Coauthor \\
% % Affiliation \\
% % Address \\
% % \texttt{email} \\
% % \AND
% % Coauthor \\
% % Affiliation \\
% % Address \\
% % \texttt{email} \\
% % \And
% % Coauthor \\
% % Affiliation \\
% % Address \\
% % \texttt{email} \\
% % \And
% % Coauthor \\
% % Affiliation \\
% % Address \\
% % \texttt{email} \\
% }
\begin{document}
\maketitle
\begin{abstract}
$if(abstract)$
$abstract$
$else$
Add your abstract at the beginning of your markdown file like this
\begin{verbatim}
---
title: "Your Title"
abstract: "your abstract here"
authors:
- name: Leonardo V. Castorina
affiliation: School of Informatics
institution: University of Edinburgh
email: justanemail@domain.ext
address: Edinburgh
- name: Coauthor
affiliation: Affiliation
institution: Institution
email: coauthor@example.com
address: Address
---
\end{verbatim}
This is called YAML frontmatter. If you set your abstract correctly you should not see this message.
$endif$
\end{abstract}
$body$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

View File

@@ -0,0 +1,56 @@
{
"commitMessage": "vault backup: {{date}}",
"commitDateFormat": "YYYY-MM-DD HH:mm:ss",
"autoSaveInterval": 0,
"autoPushInterval": 0,
"autoPullInterval": 0,
"autoPullOnBoot": false,
"disablePush": false,
"pullBeforePush": true,
"disablePopups": false,
"disablePopupsForNoChanges": false,
"listChangedFilesInMessageBody": false,
"showStatusBar": true,
"updateSubmodules": false,
"syncMethod": "merge",
"customMessageOnAutoBackup": false,
"autoBackupAfterFileChange": false,
"treeStructure": false,
"refreshSourceControl": true,
"basePath": "",
"differentIntervalCommitAndPush": false,
"changedFilesInStatusBar": false,
"showedMobileNotice": true,
"refreshSourceControlTimer": 7000,
"showBranchStatusBar": true,
"setLastSaveToLastCommit": false,
"submoduleRecurseCheckout": false,
"gitDir": "",
"showFileMenu": true,
"authorInHistoryView": "hide",
"dateInHistoryView": false,
"lineAuthor": {
"show": false,
"followMovement": "inactive",
"authorDisplay": "initials",
"showCommitHash": false,
"dateTimeFormatOptions": "date",
"dateTimeFormatCustomString": "YYYY-MM-DD HH:mm",
"dateTimeTimezone": "viewer-local",
"coloringMaxAge": "1y",
"colorNew": {
"r": 255,
"g": 150,
"b": 150
},
"colorOld": {
"r": 120,
"g": 160,
"b": 255
},
"textColorCss": "var(--text-muted)",
"ignoreWhitespace": false,
"gutterSpacingFallbackLength": 5
},
"autoCommitMessage": "vault backup: {{date}}"
}

350
.obsidian/plugins/obsidian-git/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
"id": "obsidian-git",
"name": "Git",
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.27.0"
}

View File

@@ -0,0 +1,566 @@
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.workspace-leaf-content[data-type="git-view"] .button-border {
border: 2px solid var(--interactive-accent);
border-radius: var(--radius-s);
}
.workspace-leaf-content[data-type="git-view"] .view-content {
padding: 0;
}
.workspace-leaf-content[data-type="git-history-view"] .view-content {
padding: 0;
}
.loading > svg {
animation: 2s linear infinite loading;
transform-origin: 50% 50%;
display: inline-block;
}
.obsidian-git-center {
margin: auto;
text-align: center;
width: 50%;
}
.obsidian-git-textarea {
display: block;
margin-left: auto;
margin-right: auto;
}
.obsidian-git-disabled {
opacity: 0.5;
}
.obsidian-git-center-button {
display: block;
margin: 20px auto;
}
.tooltip.mod-left {
overflow-wrap: break-word;
}
.tooltip.mod-right {
overflow-wrap: break-word;
}
.git-tools {
display: flex;
margin-left: auto;
}
.git-tools .type {
padding-left: var(--size-2-1);
display: flex;
align-items: center;
justify-content: center;
width: 11px;
}
.git-tools .type[data-type="M"] {
color: orange;
}
.git-tools .type[data-type="D"] {
color: red;
}
.git-tools .buttons {
display: flex;
}
.git-tools .buttons > * {
padding: 0 0;
height: auto;
}
.is-active .git-tools .buttons > * {
color: var(--nav-item-color-active);
}
.git-author {
color: var(--text-accent);
}
.git-date {
color: var(--text-accent);
}
.git-ref {
color: var(--text-accent);
}
.workspace-leaf-content[data-type="diff-view"] .d2h-d-none {
display: none;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper {
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header {
background-color: var(--background-primary);
border-bottom: 1px solid var(--interactive-accent);
font-family: var(--font-monospace);
height: 35px;
padding: 5px 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header,
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
font-size: 14px;
margin-left: auto;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added {
border: 1px solid #b4e2b4;
border-radius: 5px 0 0 5px;
color: #399839;
padding: 2px;
text-align: right;
vertical-align: middle;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted {
border: 1px solid #e9aeae;
border-radius: 0 5px 5px 0;
color: #c33;
margin-left: 1px;
padding: 2px;
text-align: left;
vertical-align: middle;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 15px;
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name {
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper {
border: 1px solid var(--background-modifier-border);
border-radius: 3px;
margin-bottom: 1em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid var(--background-modifier-border);
border-radius: 3px;
cursor: pointer;
display: none;
font-size: 12px;
justify-content: flex-end;
padding: 4px 8px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected {
background-color: #c8e1ff;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input {
margin: 0 4px 0 0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table {
border-collapse: collapse;
font-family: Menlo, Consolas, monospace;
font-size: 13px;
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff {
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff {
overflow-y: hidden;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff {
display: inline-block;
margin-bottom: -8px;
margin-right: -4px;
overflow-x: scroll;
overflow-y: hidden;
width: 50%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line {
padding: 0 8em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
display: inline-block;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
padding: 0 4.5em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn {
word-wrap: normal;
background: none;
display: inline-block;
padding: 0;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
vertical-align: middle;
white-space: pre;
width: 100%;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
del {
background-color: #ffb6ba;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
del {
background-color: #8d232881;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
border-radius: 0.2em;
display: inline-block;
margin-top: -1px;
text-decoration: none;
vertical-align: middle;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
ins {
background-color: #97f295;
text-align: left;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
ins {
background-color: #1d921996;
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix {
word-wrap: normal;
background: none;
display: inline;
padding: 0;
white-space: pre;
}
.workspace-leaf-content[data-type="diff-view"] .line-num1 {
float: left;
}
.workspace-leaf-content[data-type="diff-view"] .line-num1,
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
padding: 0 0.5em;
text-overflow: ellipsis;
width: 3.5em;
}
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
float: right;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-muted);
cursor: pointer;
display: inline-block;
position: absolute;
text-align: right;
width: 7.5em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after {
content: "\200b";
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-muted);
cursor: pointer;
display: inline-block;
overflow: hidden;
padding: 0 0.5em;
position: absolute;
text-align: right;
text-overflow: ellipsis;
width: 4em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-tbody tr {
position: relative;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after {
content: "\200b";
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder,
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber,
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
direction: rtl;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del {
background-color: #fee8e9;
border-color: #e9aeae;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
background-color: #dfd;
border-color: #b4e2b4;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del {
background-color: #521b1d83;
border-color: #691d1d73;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
background-color: rgba(30, 71, 30, 0.5);
border-color: #13501381;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-info {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
color: var(--text-normal);
}
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-del.d2h-change {
background-color: #fdf2d0;
}
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-del.d2h-change {
background-color: #55492480;
}
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-ins.d2h-change {
background-color: #ded;
}
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-ins.d2h-change {
background-color: rgba(37, 78, 37, 0.418);
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper {
margin-bottom: 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a {
color: #3572b0;
text-decoration: none;
}
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-list-wrapper
a:visited {
color: #3572b0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header {
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title {
font-weight: 700;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list {
display: block;
list-style: none;
margin: 0;
padding: 0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li {
border-bottom: 1px solid var(--background-modifier-border);
margin: 0;
padding: 5px 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child {
border-bottom: none;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch {
cursor: pointer;
display: none;
font-size: 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-icon {
fill: currentColor;
margin-right: 10px;
vertical-align: middle;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted {
color: #c33;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-added {
color: #399839;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-changed {
color: #d0b44c;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-moved {
color: #3572b0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-tag {
background-color: var(--background-primary);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 10px;
margin-left: 5px;
padding: 0 2px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag {
border: 2px solid #c33;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag {
border: 1px solid #399839;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag {
border: 1px solid #d0b44c;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag {
border: 1px solid #3572b0;
}
/* ====================== Line Authoring Information ====================== */
.cm-gutterElement.obs-git-blame-gutter {
/* Add background color to spacing inbetween and around the gutter for better aesthetics */
border-width: 0px 2px 0.2px 2px;
border-style: solid;
border-color: var(--background-secondary);
background-color: var(--background-secondary);
}
.cm-gutterElement.obs-git-blame-gutter > div,
.line-author-settings-preview {
/* delegate text color to settings */
color: var(--obs-git-gutter-text);
font-family: monospace;
height: 100%; /* ensure, that age-based background color occupies entire parent */
text-align: right;
padding: 0px 6px 0px 6px;
white-space: pre; /* Keep spaces and do not collapse them. */
}
@media (max-width: 800px) {
/* hide git blame gutter not to superpose text */
.cm-gutterElement.obs-git-blame-gutter {
display: none;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
{
"id": "obsidian-latex-suite",
"name": "Latex Suite",
"version": "1.9.5",
"minAppVersion": "1.0.0",
"description": "Make typesetting LaTeX math as fast as handwriting through snippets, text expansion, and editor enhancements",
"author": "artisticat",
"authorUrl": "https://github.com/artisticat1",
"fundingUrl": "https://ko-fi.com/artisticat",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,235 @@
/* Settings panel */
.setting-item.hidden {
display: none;
}
.setting-item.setting-item-heading .latex-suite-settings-icon {
margin-right: var(--size-4-2);
display: inline-flex;
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) {
border-bottom: 1px solid var(--background-modifier-border);
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) + .setting-item {
border-top: none;
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) ~ .setting-item:not(.setting-item-heading), .latex-suite-snippet-variables-setting + .setting-item-control {
width: calc(100% - 26px);
margin-left: 26px;
}
.latex-suite-snippet-variables-setting .setting-item-control {
height: 120px;
}
.latex-suite-snippet-variables-setting .setting-item-control textarea {
width: 100%;
height: 100%;
}
.snippets-text-area, .latex-suite-snippet-variables-setting {
display: inline-block;
}
.snippets-text-area .setting-item-info, .latex-suite-snippet-variables-setting .setting-item-info {
margin-bottom: 0.75rem;
}
.snippets-text-area .setting-item-control {
flex-direction: column;
align-items: flex-end;
}
.snippets-editor-wrapper {
width: 100%;
margin-bottom: 0.75rem;
}
.snippets-editor-wrapper .cm-editor {
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
font-size: var(--font-inputs);
height: 20em;
outline: none !important;
text-align: left;
}
.snippets-editor-wrapper .cm-line, .snippets-editor-wrapper .cm-lineNumbers {
font-family: var(--font-monospace);
}
.snippets-footer {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.snippets-editor-validity {
display: flex;
align-items: center;
}
.snippets-editor-validity-indicator {
color: white;
display: inline-block;
border-radius: 1em;
margin-right: 10px;
cursor: default;
visibility: hidden;
}
.snippets-editor-validity-indicator svg {
width: 16px !important;
height: 16px !important;
}
.snippets-editor-validity-indicator:hover {
color: white;
}
.snippets-editor-validity-indicator.valid {
background-color: var(--color-green);
visibility: visible;
}
.snippets-editor-validity-indicator.invalid {
background-color: var(--color-red);
visibility: visible;
}
.snippets-editor-buttons {
display: flex;
flex-direction: row;
}
.latex-suite-confirmation-modal .setting-item {
border: none;
}
.search-input-container input.latex-suite-location-input-el {
width: initial;
}
/*
Snippet color classes.
*/
/* These extra selectors enforce their color on all children, because CodeMirror does weird nesting of spans when
nesting multiple decorations. */
.latex-suite-snippet-placeholder {
border-radius: 2px;
background-color: var(--placeholder-bg);
outline: var(--placeholder-outline) solid 1px;
}
.latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
--placeholder-bg: #87cefa2e;
--placeholder-outline: #87cefa6e;
}
.theme-dark .latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
--placeholder-outline: #87cefa43;
}
.latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
--placeholder-bg: #ffa50033;
--placeholder-outline: #ffa5006b;
}
.theme-dark .latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
--placeholder-outline: #ffa5004d;
}
.latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
--placeholder-bg: #00ff0022;
--placeholder-outline: #00ff0060;
}
.theme-dark .latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
--placeholder-outline: #00ff003d;
}
/* Conceal */
span.cm-math.cm-concealed-bold {
font-weight: bold;
}
span.cm-math.cm-concealed-underline {
text-decoration: underline;
}
span.cm-math.cm-concealed-mathrm, sub.cm-math.cm-concealed-mathrm {
font-style: normal;
}
/* Conceal superscripts without changing line height */
sup.cm-math {
line-height: 0;
}
sup.cm-math, sub.cm-math {
font-style: italic;
}
/* Inline math tooltip styling */
.theme-light .cm-tooltip.cm-tooltip-cursor {
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.028), 0px 3.4px 6.7px rgba(0, 0, 0, .042), 0px 5px 20px rgba(0, 0, 0, .07);
}
.theme-dark .cm-tooltip.cm-tooltip-cursor {
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1),
0px 3.4px 6.7px rgba(0, 0, 0, 0.15),
0px 0px 30px rgba(0, 0, 0, 0.27);
}
/* Highlight brackets */
.theme-light .latex-suite-highlighted-bracket, .theme-light .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
background-color: hsl(var(--accent-h), var(--accent-s), 40%, 0.3);
}
.theme-dark .latex-suite-highlighted-bracket, .theme-dark .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
background-color: hsl(var(--accent-h), var(--accent-s), 70%, 0.6);
}
/* Color matching brackets */
.theme-light .latex-suite-color-bracket-0, .theme-light .latex-suite-color-bracket-0 .cm-bracket {
color: #527aff;
}
.theme-dark .latex-suite-color-bracket-0, .theme-dark .latex-suite-color-bracket-0 .cm-bracket {
color: #47b8ff;
}
.theme-light .latex-suite-color-bracket-1, .theme-light .latex-suite-color-bracket-1 .cm-bracket {
color: #ff50b7;
}
.theme-dark .latex-suite-color-bracket-1, .theme-dark .latex-suite-color-bracket-1 .cm-bracket {
color: #ff55cd;
}
.theme-light .latex-suite-color-bracket-2, .theme-light .latex-suite-color-bracket-2 .cm-bracket {
color: #69ba00;
}
.theme-dark .latex-suite-color-bracket-2, .theme-dark .latex-suite-color-bracket-2 .cm-bracket {
color: #73ff63;
}
/* .latex-suite-color-bracket-3 {
color: #8de15c;
} */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-plantuml",
"name": "PlantUML",
"version": "1.8.0",
"minAppVersion": "1.5.7",
"description": "Render PlantUML Diagrams",
"author": "Johannes Theiner",
"authorUrl": "https://github.com/joethei/",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,38 @@
.puml-settings-area {
margin-left: 5px;
margin-right: 5px;
font-size: 14px;
width: 100%;
}
.plantuml-source-view .cm-activeLine {
background-color: unset !important;
}
.plantuml-source-view .cm-gutters {
background-color: unset !important;
}
.plantuml-source-view .cm-cursor {
border-left: 1.2px solid var(--text-muted);
}
.plantuml-source-view .cm-selectionBackground {
background-color: var(--text-selection) !important;
}
.puml-loading {
color: var(--text-accent);
}
.internal-embed.file-embed[src$=".puml"] {
display: none;
}
.internal-embed.file-embed[src$=".pu"] {
display: none;
}
.puml-error {
color: var(--text-error);
}

View File

@@ -0,0 +1,6 @@
{
"formatType": "normal",
"showRibbonIcon": true,
"bindEnter": true,
"bindTab": true
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
{
"id": "table-editor-obsidian",
"name": "Advanced Tables",
"author": "Tony Grosinger",
"authorUrl": "https://grosinger.net",
"description": "Improved table navigation, formatting, manipulation, and formulas",
"isDesktopOnly": false,
"minAppVersion": "1.0.0",
"version": "0.22.0",
"js": "main.js",
"fundingUrl": {
"Github Sponsor": "https://github.com/sponsors/tgrosinger",
"Buy me a Coffee": "https://buymeacoffee.com/tgrosinger",
"Paypal": "https://paypal.me/tgrosinger"
},
"donation": "https://buymeacoffee.com/tgrosinger"
}

View File

@@ -0,0 +1,78 @@
:root {
--advanced-tables-helper-size: 28px;
}
.HyperMD-table-row span.cm-inline-code {
font-size: 100%;
padding: 0px;
}
.advanced-tables-buttons>div>.title {
font-weight: var(--font-medium);
font-size: var(--nav-item-size);
color: var(--nav-item-color);
text-decoration: underline;
}
[data-type="advanced-tables-toolbar"] .nav-buttons-container {
column-gap: 0.2rem;
margin: 0.2rem 0 0.2rem 0;
justify-content: start;
}
[data-type="advanced-tables-toolbar"] .nav-buttons-container::before {
min-width: 2.6rem;
line-height: var(--advanced-tables-helper-size);
font-size: var(--nav-item-size);
font-weight: var(--nav-item-weight);
color: var(--nav-item-color);
}
[data-type="advanced-tables-toolbar"] .nav-buttons-container>* {
height: var(--advanced-tables-helper-size);
line-height: var(--advanced-tables-helper-size);
}
[data-type="advanced-tables-toolbar"] .nav-buttons-container .nav-action-button {
width: var(--advanced-tables-helper-size);
height: var(--advanced-tables-helper-size);
display: flex;
justify-content: center;
align-items: center;
border-radius: var(--radius-s);
}
[data-type="advanced-tables-toolbar"] .nav-buttons-container .nav-action-button:hover {
background-color: var(--nav-item-background-hover);
color: var(--nav-item-color-hover);
font-weight: var(--nav-item-weight-hover);
}
.advanced-tables-row-label {
width: 50px;
}
.widget-icon {
width: 20px;
height: 20px;
fill: var(--text-muted);
}
.widget-icon:hover {
fill: var(--text-normal);
}
.advanced-tables-csv-export textarea {
height: 200px;
width: 100%;
}
.advanced-tables-donation {
width: 70%;
margin: 0 auto;
text-align: center;
}
.advanced-tables-donate-button {
margin: 10px;
}

20
.obsidian/snippets/nota.css vendored Normal file
View File

@@ -0,0 +1,20 @@
div.nota {
background-color: #ffc4dc;
border: 1px solid #ff80aa;
border-radius: 5px;
padding: 10px;
margin-top: 10px;
margin-bottom: 10px;
color: #8b002e;
}
div.nota > h4 {
margin-top: 0;
text-decoration: underline;
margin-bottom: 5px;
}
div.nota > p {
margin-top: 0;
margin-bottom: 0;
}

6
.obsidian/themes/Atom/manifest.json vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "Atom",
"version": "0.0.0",
"minAppVersion": "0.16.0",
"author": "kognise"
}

339
.obsidian/themes/Atom/theme.css vendored Normal file
View File

@@ -0,0 +1,339 @@
/* Base colors - TODO: are grey 1 and grey 2 used? */
.theme-dark {
--accent-h: 219;
--accent-s: 56%;
--accent-l: 55%;
--background-primary: #272b34;
--background-primary-alt: #20242b;
--background-secondary: #20242b;
--background-secondary-alt: #1a1e24;
--background-accent: #000;
--background-modifier-border: #424958;
--background-modifier-form-field: rgba(0, 0, 0, 0.3);
--background-modifier-form-field-highlighted: rgba(0, 0, 0, 0.22);
--background-modifier-box-shadow: rgba(0, 0, 0, 0.3);
--background-modifier-success: #539126;
--background-modifier-error: #3d0000;
--background-modifier-error-rgb: 61, 0, 0;
--background-modifier-error-hover: #470000;
--background-modifier-cover: rgba(0, 0, 0, 0.6);
--text-accent: #61afef;
--text-accent-hover: #70bdfc;
--text-normal: #dcddde;
--text-muted: #888;
--text-faint: rgb(81, 86, 99);
--text-error: #e16d76;
--text-error-hover: #c9626a;
--text-highlight-bg: rgba(255, 255, 0, 0.4);
--text-selection: rgba(0, 122, 255, 0.2);
--text-on-accent: #dcddde;
--interactive-normal: #20242b;
--interactive-hover: #353b47;
--interactive-accent-hover: hsl(var(--accent-h), calc(var(--accent-s) + 5%), calc(var(--accent-l) - 10%));
--scrollbar-active-thumb-bg: rgba(255, 255, 255, 0.2);
--scrollbar-bg: rgba(255, 255, 255, 0.05);
--scrollbar-thumb-bg: rgba(255, 255, 255, 0.1);
--panel-border-color: #18191e;
--gray-1: #5C6370;
--gray-2: #abb2bf;
--red: #e06c75;
--orange: #d19a66;
--green: #98c379;
--aqua: #56b6c2;
--purple: #c678dd;
--blue: #61afef;
--yellow: #e5c07b;
--background-modifier-hover: hsla(var(--accent-h), calc(var(--accent-s) - 35%), var(--accent-l), 0.06);
--divider-color-hover: #404754;
}
.theme-light {
--accent-h: 230;
--accent-s: 83%;
--accent-l: 64%;
--background-primary: #fafafa;
--background-primary-alt: #eaeaeb;
--background-secondary: #eaeaeb;
--background-secondary-alt: #dbdbdc;
--background-accent: #fff;
--background-modifier-border: #dbdbdc;
--background-modifier-form-field: #fff;
--background-modifier-form-field-highlighted: #fff;
--background-modifier-box-shadow: rgba(0, 0, 0, 0.1);
--background-modifier-success: #A4E7C3;
--background-modifier-error: #e68787;
--background-modifier-error-rgb: 230, 135, 135;
--background-modifier-error-hover: #FF9494;
--background-modifier-cover: rgba(0, 0, 0, 0.8);
--text-accent: #1592ff;
--text-accent-hover: #097add;
--text-normal: #383a42;
--text-muted: #8e8e90;
--text-faint: #999999;
--text-error: #e75545;
--text-error-hover: #f86959;
--text-highlight-bg: rgba(255, 255, 0, 0.4);
--text-selection: rgba(0, 122, 255, 0.15);
--text-on-accent: #f2f2f2;
--interactive-normal: #eaeaeb;
--interactive-hover: #dbdbdc;
--interactive-accent-rgb: 21, 146, 255;
--interactive-accent-hover: hsl(var(--accent-h), calc(var(--accent-s) - 10%), calc(var(--accent-l) - 4%));
--scrollbar-active-thumb-bg: rgba(0, 0, 0, 0.2);
--scrollbar-bg: rgba(0, 0, 0, 0.05);
--scrollbar-thumb-bg: rgba(0, 0, 0, 0.1);
--panel-border-color: #dbdbdc;
--gray-1: #383a42;
--gray-2: #383a42;
--red: #e75545;
--green: #4ea24c;
--blue: #3d74f6;
--purple: #a625a4;
--aqua: #0084bc;
--yellow: #e35649;
--orange: #986800;
}
.theme-dark, .theme-light {
--ribbon-background: var(--background-primary);
--drag-ghost-background: var(--background-secondary-alt);
--background-modifier-message: var(--background-secondary-alt);
--tab-outline-color: transparent;
--divider-color: transparent;
--prompt-border-color: var(--panel-border-color);
--modal-border-color: var(--panel-border-color);
--background-modifier-border-hover: var(--interactive-hover);
--background-modifier-border-focus: var(--interactive-hover);
--checkbox-color: var(--text-accent);
--checkbox-color-hover: var(--text-accent-hover);
--nav-item-background-active: var(--interactive-accent);
--nav-item-color-active: #ffffff;
--tag-color: var(--yellow);
--tag-background: var(--background-primary-alt);
--tag-color-hover: var(--yellow);
--tag-background-hover: var(--background-primary-alt);
--tag-padding-x: 4px;
--tag-padding-y: 2px;
--tag-radius: 4px;
--inline-title-weight: var(--bold-weight);
--link-decoration: none;
--link-external-decoration: none;
--embed-padding: 0 0 0 var(--size-4-4);
}
/* Search */
.search-result .search-result-file-title {
cursor: pointer;
}
.search-result .collapse-icon {
cursor: var(--cursor);
}
.search-result:not(.is-collapsed) .search-result-file-title {
color: var(--blue);
}
/* File tab separators */
.workspace .mod-root .workspace-tab-header-inner::after {
right: unset;
left: -0.5px;
}
.workspace .mod-root .workspace-tab-header:last-child .workspace-tab-header-inner::before {
position: absolute;
right: -0.5px;
width: 1px;
background-color: var(--tab-divider-color);
content: '';
height: 20px;
}
.workspace .mod-root .workspace-tab-header.is-active .workspace-tab-header-inner::after,
.workspace .mod-root .workspace-tab-header.is-active .workspace-tab-header-inner::before,
.workspace .mod-root .workspace-tab-header:first-child .workspace-tab-header-inner::after,
.workspace .mod-root .workspace-tab-header.is-active + .workspace-tab-header .workspace-tab-header-inner::after {
opacity: 0;
}
/* Editor and output */
.markdown-rendered blockquote {
padding: var(--embed-padding);
}
mjx-container {
text-align: left !important;
}
.math-block {
font-size: 1.3em;
}
.theme-light :not(pre)>code,
.theme-light pre {
background: var(--background-primary);
box-shadow: inset 0 0 0 1px var(--background-primary-alt);
border-radius: 4px;
}
.markdown-preview-section > div h1,
.markdown-preview-section > div h2,
.markdown-preview-section > div h3,
.markdown-preview-section > div h4,
.markdown-preview-section > div h5,
.markdown-preview-section > div h6 {
margin-top: 40px;
}
.mod-header + div h1,
.mod-header + div h2,
.mod-header + div h3,
.mod-header + div h4,
.mod-header + div h5,
.mod-header + div h6 {
margin-top: 30px;
}
.cm-sizer > .inline-title {
margin-bottom: 20px;
}
/* Miscellaneous */
.theme-dark .dropdown:hover {
background-color: var(--background-modifier-form-field);
}
.tooltip {
color: var(--text-muted);
}
.nav-file, .nav-folder {
padding: 1px 2px;
}
body:not(.is-grabbing) .nav-file-title.is-being-dragged,
body:not(.is-grabbing) .nav-folder-title.is-being-dragged,
.nav-file-title.is-being-dragged,
.nav-folder-title.is-being-dragged {
background-color: var(--background-primary-alt);
color: var(--nav-item-color);
}
.view-header-title {
text-decoration: underline;
text-decoration-color: var(--text-muted);
text-underline-offset: 1.5px;
}
.status-bar {
border-color: var(--panel-border-color);
border-width: 1px;
padding: 4px 8px;
}
.theme-dark button.mod-warning {
--background-modifier-error: #d42020;
--background-modifier-error-hover: #b01515;
}
.theme-light button.mod-warning {
--background-modifier-error: #f23f3f;
--background-modifier-error-hover: #d72020;
}
/* Code syntax highlighting */
code[class*='language-'], pre[class*='language-'] {
text-align: left !important;
white-space: pre !important;
word-spacing: normal !important;
word-break: normal !important;
word-wrap: normal !important;
line-height: 1.5 !important;
tab-size: 4 !important;
hyphens: none !important;
}
pre[class*='language-'] {
/* Code blocks */
padding: 1em !important;
margin: .5em 0 !important;
overflow: auto !important;
}
:not(pre)>code[class*='language-'] {
/* Inline code */
padding: .1em !important;
border-radius: .3em !important;
white-space: normal !important;
}
.token.comment, .token.prolog, .token.doctype, .token.cdata,
.HyperMD-codeblock .cm-comment {
color: var(--gray-1) !important;
}
.token.punctuation,
.HyperMD-codeblock .cm-hmd-codeblock, .HyperMD-codeblock .cm-bracket {
color: var(--gray-2) !important;
}
.token.selector, .token.tag,
.HyperMD-codeblock .cm-tag, .HyperMD-codeblock .cm-property, .HyperMD-codeblock .cm-meta, .HyperMD-codeblock .cm-qualifier, .HyperMD-codeblock .cm-header, .HyperMD-codeblock .cm-quote, .HyperMD-codeblock .cm-hr, .HyperMD-codeblock .cm-link {
color: var(--red) !important;
}
.token.property, .token.boolean, .token.number, .token.constant, .token.symbol, .token.attr-name, .token.deleted,
.HyperMD-codeblock .cm-number, .HyperMD-codeblock .cm-atom, .HyperMD-codeblock .cm-attribute {
color: var(--orange) !important;
}
.token.string, .token.char, .token.attr-value, .token.builtin, .token.inserted,
.HyperMD-codeblock .cm-string, .HyperMD-codeblock .cm-builtin {
color: var(--green) !important;
}
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string,
.HyperMD-codeblock .cm-string-2, .HyperMD-codeblock .cm-operator {
color: var(--aqua) !important;
}
.token.atrule, .token.keyword,
.HyperMD-codeblock .cm-keyword {
color: var(--purple) !important;
}
.token.function, .token.macro.property,
.HyperMD-codeblock .cm-def, .HyperMD-codeblock .cm-variable {
color: var(--blue) !important;
}
.token.class-name,
.HyperMD-codeblock .cm-variable-2, .HyperMD-codeblock .cm-variable-3 {
color: var(--yellow) !important;
}
.token.regex, .token.important, .token.variable {
color: var(--purple) !important;
}
.token.important, .token.bold {
font-weight: bold !important;
}
.token.italic {
font-style: italic !important;
}
.token.entity {
cursor: help !important;
}

199
.obsidian/workspace-DESKTOP-RNLO2NH.json vendored Normal file
View File

@@ -0,0 +1,199 @@
{
"main": {
"id": "8d26a6fe9f964f6b",
"type": "split",
"children": [
{
"id": "8854f31f774c7fae",
"type": "tabs",
"children": [
{
"id": "8066c35382950b25",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "TERCERO/SS/SS 24-25.md",
"mode": "source",
"source": false
}
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "a9100b68fb330cb9",
"type": "split",
"children": [
{
"id": "e23565b29f0b0277",
"type": "tabs",
"children": [
{
"id": "a4eac8e6613b153b",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
}
}
},
{
"id": "dd5726e5114a7c4e",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
}
},
{
"id": "1cbe9729fd2cf604",
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "44cf06183e1c1c7d",
"type": "split",
"children": [
{
"id": "49cbf6da2f29f564",
"type": "tabs",
"children": [
{
"id": "1e44a907904513ce",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"file": "TERCERO/SS/SS 24-25.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "1f08a0ec99cf4a21",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"file": "TERCERO/SS/SS 24-25.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "2f9a57a1dc058b86",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
}
}
},
{
"id": "32907795dd5fbf3f",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"file": "TERCERO/SS/SS 24-25.md"
}
}
}
]
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"canvas:Create new canvas": false,
"daily-notes:Open today's daily note": false,
"templates:Insert template": false,
"command-palette:Open command palette": false,
"table-editor-obsidian:Advanced Tables Toolbar": false
}
},
"active": "8066c35382950b25",
"lastOpenFiles": [
"TERCERO/SS/images/Pasted image 20241003113528.png",
"TERCERO/SS/SS 24-25.md",
"TERCERO/SS/SS Lab.md",
"SEGUNDO/ADDA/Teoría_2324.md",
"TERCERO/ATR1/Teoría_2425.md",
"TERCERO/SS/images/Pasted image 20241002112436.png",
"TERCERO/SS/images/Pasted image 20241002112350.png",
"TERCERO/SS/images/Pasted image 20241002112049.png",
"TERCERO/IA/Teoría_2425.md",
"TERCERO/IA/Apuntes Julia.md",
"SEGUNDO/IISSI2/Teoría_2324.md",
"Pasted image 20240930133736.png",
"TERCERO/ATR1/images/Pasted image 20240930133748.png",
"TERCERO/ATR1/images/Pasted image 20240930133135.png",
"TERCERO/SPD/Teoría_2425.md",
"TERCERO/SPD/images/Ley_de_Moore.png",
"TERCERO/SPD/images/550px-Ley_de_Moore.png",
"TERCERO/SPD/images/medias.png",
"SEGUNDO/IISSI1/Teoría_2324.md",
"TERCERO/SS/images",
"TERCERO/SPD/images",
"TERCERO/IA/images",
"TERCERO/ATR1/images",
"TERCERO/ATR1/Welcome.md",
"SEGUNDO/ADDA/MemoriaPI4_SMT4497.docx",
"SEGUNDO/ADDA/PI4_SMT4497.zip",
"SEGUNDO/ADDA/MemoriaPI5_SMT4497.pdf",
"SEGUNDO/ADDA/ADDA 23-24.md",
"SEGUNDO/ADDA/MODELOS.md",
"SEGUNDO/ADDA/ADDA 15-05.md",
"SEGUNDO/ADDA/ADDA 15-03.md",
"SEGUNDO/ADDA/ADDA 13-03.md",
"SEGUNDO/AC/Teoría_2324.md",
"TERCERO/IA",
"TERCERO/SS",
"TERCERO/SPD",
"SEGUNDO/MD/Apuntes Sage.md",
"SEGUNDO/RC/Teoría_2324.md",
"SEGUNDO/RC/Untitled.md",
"SEGUNDO/TC/Teoría_2324.md",
"SEGUNDO/SO/Teoría_2324.md",
"SEGUNDO/SO/Untitled.md",
"SEGUNDO/SO/Sin título.md",
"SEGUNDO/SO/Sin título.canvas",
"SEGUNDO/SO/Untitled 2.md",
"SEGUNDO/SO/Untitled 1.md"
]
}

208
.obsidian/workspace.json vendored Normal file
View File

@@ -0,0 +1,208 @@
{
"main": {
"id": "8d26a6fe9f964f6b",
"type": "split",
"children": [
{
"id": "8854f31f774c7fae",
"type": "tabs",
"children": [
{
"id": "8066c35382950b25",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "TERCERO/SS/SS 24-25.md",
"mode": "source",
"source": false
}
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "a9100b68fb330cb9",
"type": "split",
"children": [
{
"id": "e23565b29f0b0277",
"type": "tabs",
"children": [
{
"id": "a4eac8e6613b153b",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
}
}
},
{
"id": "dd5726e5114a7c4e",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
}
},
{
"id": "1cbe9729fd2cf604",
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "44cf06183e1c1c7d",
"type": "split",
"children": [
{
"id": "49cbf6da2f29f564",
"type": "tabs",
"children": [
{
"id": "1e44a907904513ce",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"file": "TERCERO/SS/SS 24-25.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "1f08a0ec99cf4a21",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"file": "TERCERO/SS/SS 24-25.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "2f9a57a1dc058b86",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
}
}
},
{
"id": "32907795dd5fbf3f",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"file": "TERCERO/SS/SS 24-25.md"
}
}
},
{
"id": "b40a18c39aef8e17",
"type": "leaf",
"state": {
"type": "git-view",
"state": {}
}
}
],
"currentTab": 4
}
],
"direction": "horizontal",
"width": 300
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"canvas:Create new canvas": false,
"daily-notes:Open today's daily note": false,
"templates:Insert template": false,
"command-palette:Open command palette": false,
"table-editor-obsidian:Advanced Tables Toolbar": false,
"obsidian-git:Open Git source control": false
}
},
"active": "a4eac8e6613b153b",
"lastOpenFiles": [
"TERCERO/SS/images/Pasted image 20241003113528.png",
"TERCERO/SS/SS 24-25.md",
"TERCERO/SS/SS Lab.md",
"SEGUNDO/ADDA/Teoría_2324.md",
"TERCERO/ATR1/Teoría_2425.md",
"TERCERO/SS/images/Pasted image 20241002112436.png",
"TERCERO/SS/images/Pasted image 20241002112350.png",
"TERCERO/SS/images/Pasted image 20241002112049.png",
"TERCERO/IA/Teoría_2425.md",
"TERCERO/IA/Apuntes Julia.md",
"SEGUNDO/IISSI2/Teoría_2324.md",
"Pasted image 20240930133736.png",
"TERCERO/ATR1/images/Pasted image 20240930133748.png",
"TERCERO/ATR1/images/Pasted image 20240930133135.png",
"TERCERO/SPD/Teoría_2425.md",
"TERCERO/SPD/images/Ley_de_Moore.png",
"TERCERO/SPD/images/550px-Ley_de_Moore.png",
"TERCERO/SPD/images/medias.png",
"SEGUNDO/IISSI1/Teoría_2324.md",
"TERCERO/SS/images",
"TERCERO/SPD/images",
"TERCERO/IA/images",
"TERCERO/ATR1/images",
"TERCERO/ATR1/Welcome.md",
"SEGUNDO/ADDA/MemoriaPI4_SMT4497.docx",
"SEGUNDO/ADDA/PI4_SMT4497.zip",
"SEGUNDO/ADDA/MemoriaPI5_SMT4497.pdf",
"SEGUNDO/ADDA/ADDA 23-24.md",
"SEGUNDO/ADDA/MODELOS.md",
"SEGUNDO/ADDA/ADDA 15-05.md",
"SEGUNDO/ADDA/ADDA 15-03.md",
"SEGUNDO/ADDA/ADDA 13-03.md",
"SEGUNDO/AC/Teoría_2324.md",
"TERCERO/IA",
"TERCERO/SS",
"TERCERO/SPD",
"SEGUNDO/MD/Apuntes Sage.md",
"SEGUNDO/RC/Teoría_2324.md",
"SEGUNDO/RC/Untitled.md",
"SEGUNDO/TC/Teoría_2324.md",
"SEGUNDO/SO/Teoría_2324.md",
"SEGUNDO/SO/Untitled.md",
"SEGUNDO/SO/Sin título.md",
"SEGUNDO/SO/Sin título.canvas",
"SEGUNDO/SO/Untitled 2.md",
"SEGUNDO/SO/Untitled 1.md"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

482
SEGUNDO/AC/Teoría_2324.md Normal file
View File

@@ -0,0 +1,482 @@
# <mark style="background: #FFF3A3A6;">TEMA 1: El Procesador</mark>
## <mark style="background: #ADCCFFA6;">1. Introducción</mark>
### <mark style="background: #D2B3FFA6;">- Tiempo de CPU</mark>
$$
\begin{equation}
T_{CPU}=\frac{NºInstr\times CPI}{F_{CLK}}=NºInstr\times CPI\times T_{CLK}
\end{equation}
$$
- **Nº Instrucciones:** número de instrucciones ejecutadas. Está condicionado por el programador/compilador y por el ISA.
- **CPI:** ciclos (de reloj) por instrucción. Está condicionado por la propia arquitectura.
- **Periodo:** duración de un ciclo. Está condicionado por la arquitectura/tecnología.
### <mark style="background: #D2B3FFA6;">- Aceleración</mark>
$$
\begin{equation}
Ac_{A-B}=\frac{T_{CPU,~B}}{T_{CPU,~A}}
\end{equation}
$$
Si el resultado es menor que 1, el procesador A no es el más rápido, se intercambian de sitio A y B y a repetir. Si $Ac_{A-B}=1,3$, el procesador A es un 30% más rápido que el B.
### <mark style="background: #D2B3FFA6;">- Procesador monociclo</mark>
Cada instrucción se ejecuta en un ciclo ($CPI=1$). El periodo de reloj lo determina la instrucción de más duración. Puede resultar ineficiente ya que las instrucciones de menor duración desperdician tiempo de procesador.
### <mark style="background: #D2B3FFA6;">- Procesador secuencial multiciclo</mark>
La ejecución de una instrucción se divide en fases. Cada fase se ejecuta en un ciclo. La duración del periodo está determinada por la fase más larga. El tiempo de ejecución de cada instrucción varía ya que dependerá de su número de fases.
### <mark style="background: #D2B3FFA6;">- Procesador segmentado</mark>
Es un símil con una cadena de montaje, es decir, cada instrucción comienza en cada ciclo de reloj antes de terminar la anterior. Se solapan varias instrucciones pero en fases distintas. Las fases no pueden compartir recursos o dará lugar a dependencias.
## <mark style="background: #ADCCFFA6;">2. RISC-V</mark>
### <mark style="background: #D2B3FFA6;">- Características</mark>
Versión RISC-V de 32 bits:
- Tamaño de palabra de 32 bits: registros, memoria, operaciones.
- Direcciones de 32 bits $\rightarrow$ direccionamiento 4GB
- Accesos a memoria a nivel de byte, half-word y word.
- Formato Little Endian.
- Direccionamiento simple (acceso a datos y a código).
- 32 registros de enteros de 32 bits (también de floating point).
### <mark style="background: #D2B3FFA6;">- Formato de las instrucciones</mark>
- **Formato R**
![[Pasted image 20240306123152.png]]
Todas las instrucciones con tres registros. **Function** extiende el campo **opcode**. **Aux** se utiliza en algunas instrucciones. Ejemplos de instrucciones tipo R son: `add, sub, and, or, xor, sll, srl, slt...`
- **Formato I**
![[Pasted image 20240306123319.png]]
Todas las instrucciones con inmediatos. Incluye saltos condicionales (`beq, bne, blt, bge...`) y accesos a memoria (loads y stores). Ejemplos de instrucciones tipo I son: `addi, andi, slli, ori, xori...`
- **Formato J**
![[Pasted image 20240306123449.png]]
Instrucción de salto incondicional `jal`. Requiere un formato específico pues utiliza el modo de direccionamiento pseudo-absoluto para indicar la dirección de destino del salto.
## <mark style="background: #ADCCFFA6;">3. Camino de datos</mark>
### <mark style="background: #D2B3FFA6;">- RISC-V monociclo</mark>
![[Pasted image 20240306124213.png]]
### <mark style="background: #D2B3FFA6;">- RISC-V segmentado</mark>
![[Pasted image 20240306124829.png]]
| Etapa | Descripción |
| ----- | --------------------------------------------------------------------------------------------- |
| IF | Busca la instrucción y actualiza el PC |
| ID | Decodifica la instrucción, lee los registros y resuelve saltos si hubiera |
| EX | ALU: realiza la operación correspondiente<br>Carga/Almacenamiento: calcula la dir. de memoria |
| ME | Carga: lee el dato de memoria<br>Almacenamiento: escribe el dato en memoria |
| WB | Escribe el resultado en el fichero de registros |
## <mark style="background: #ADCCFFA6;">4. Riesgos y dependencias</mark>
- **Dependencia:** si la ejecución de una instrucción está condicionada por otra anterior de alguna forma.
- **Riesgo:** situación que impide iniciar la siguiente instrucción en el próximo ciclo debido a su dependencia. Hay varios tipos de riesgos:
- **Estructurales:** si se intenta usar un recurso al mismo tiempo.
- **De datos:** si se altera el orden natural en el que deben producirse las R/W.
- **De control:** si se ejecutan instrucciones posteriores a un salto no resuelto.
### <mark style="background: #D2B3FFA6;">- Riesgos estructurales</mark>
Cuando varias instrucciones requieren utilizar un mismo recurso
simultáneamente (recurso compartido por varias etapas) sin estar
diseñado para ello. Se pueden solucionar de varias formas:
- Añadir un recurso con capacidad para acceso simultáneo.
- Dotar al recurso con capacidad para acceso simultáneo.
- Bloquear la instrucción (afecta al rendimiento $\rightarrow CPI>1$)
#### 1. Añadir un recurso propio a cada etapa que lo precise
**Ejemplo:** las etapas IF y ME acceden a memoria pero cada una tiene su propia memoria. IF tiene una memoria de instrucciones IM y ME tiene una memoria de datos DM.
![[Pasted image 20240306131213.png]]
#### 2. Recursos con capacidad para acceso simultáneo
**Ejemplo:** el fichero de registros requiere 3 accesos en un mismo ciclo. La etapa ID realiza hasta 2 lecturas y la etapa WB realiza 1 escritura. Se soluciona con un fichero de registros de 3 puertos (2 de R y 1 de W).
![[Pasted image 20240306131335.png]]
#### 3. Bloquear la instrucción
Si el recurso está ocupado la instrucción no podrá ejecutar la etapa por lo que tendrá que esperar al siguiente ciclo.
![[Pasted image 20240306131615.png]]
![[Pasted image 20240306131628.png]]
### <mark style="background: #D2B3FFA6;">- Riesgos de datos</mark>
Situación que impide ejecutar una instrucción por la relación que guardan sus operandos con otros de instrucciones anteriores. Hay de varios tipos:
<mark style="background: #BBFABBA6;"> </mark> $\equiv$ en RISC-V si
<mark style="background: #FF5582A6;"> </mark> $\equiv$ en RISC-V no
#### <mark style="background: #BBFABBA6;">1. RAW (Read After Write)</mark>
Intenta leer el operando antes de que una instrucción anterior lo haya escrito. R en fase anterior a la W.
![[Pasted image 20240306132700.png]]
Se debería leer el valor actualizado de R1. Hay varias soluciones para los riesgos tipo RAW:
- **Bloquear:** la instrucción dependiente debe esperar en la etapa ID hasta que la instrucción de la que depende actualice el resultado. Degrada el rendimiento al retrasar la cadena.
- **Adelantamiento:** añadir buses para hacer bypass entre etapas y poder usar resultados calculados entre etapas. Mejora el rendimiento. Requiere MUX y buses.
- **Reordenar:** consiste en separar las instrucciones que producen riesgos de datos entre ellas, reordenando el código pero sin cambiar el funcionamiento de este.
#### <mark style="background: #BBFABBA6;">2. WAW (Write After Write)</mark>
Intenta escribir antes de hacerlo una instrucción anterior. Puede ocurrir si la escritura se realiza en varias etapas o si hay instrucciones de larga duración (tiene fases que duran un ciclo cada una, como `mul` o `div`).
![[Pasted image 20240306132653.png]]
R1 de la primera instrucción se debería haber actualizado antes, por tanto queda desactualizado.
#### <mark style="background: #FF5582A6;">3. WAR (Write After Read)</mark>
Intenta escribir antes de que una instrucción anterior lo haya leído. W en fase anterior a la R.
![[Pasted image 20240306132551.png]]
**NO** se debería leer el valor actualizado de R1.
En RISC-V no se producen ya que se escribe en WB y se lee en ID.
#### <mark style="background: #FF5582A6;">4. RAR (Read After Read)</mark>
No existen pues alterar el orden de R no es un riesgo.
### <mark style="background: #D2B3FFA6;">- Riesgos de control</mark>
Condicionan el flujo de control, es decir, la siguiente instrucción a ejecutar. Dos tipos de instrucciones, saltos condicionales e incondicionales. Las posibles soluciones son:
- **Bloquear:** cancelar la ejecución de las instrucciones que comenzaron indebidamente. Cada instrucción cancelada, 1 ciclo de bloqueo, por lo que empeora el rendimiento.
- **Salto retardado:** no cancelar la ejecución de instrucciones posteriores al salto, pues fueron sustituidas por instrucciones válidas. Lo debe soportar el compilador.
- **Predecir el salto:** predicción estática (en compilación) o dinámica (en ejecución).
### Ejercicio 39. Sea el procesador RISC-LLV inspirado en el RISC-V con desvíos, con las etapas:
<table border="1">
<tr>
<td>
IF
</td>
<td>
ID
</td>
<td>
LL
</td>
<td>
EX
</td>
<td>
ME
</td>
<td>
WB
</td>
</tr>
</table>
#### Esta arquitectura incluye la etapa LL que debe ser capaz de realizar 2 lecturas simultáneas en la memoria de datos (sólo realizará lecturas). Para ello, la memoria de datos incluye un segundo puerto, pero sólo habilitado para la lectura. Este procesador enriquece el repertorio de instrucciones del RISC-V con nuevas instrucciones de salto condicionales capaces de evaluar la condición del salto comparando valores en memoria mediante el modo de direccionamiento de registro base más desplazamiento. Un ejemplo de una instrucción de este tipo sería:
`beqm 4(x1), 8(x2), etiq` $\rightarrow$ Salta a etiq si (Mem[x1+4] == Mem[x2+8])
a) El formato de la instrucción sería formato I, ya que la instrucción necesita dos registros fuente. El formato se modificaría dividiendo el campo de inmediato en tres partes `dir. salto`, `inm2`, `inm1`, de 6, 5 y 5 bits respectivamente.
b)
**IF:**
PC4 $\leftarrow$ PC+4
**ID:** NUEVOS SUMADORES
A $\leftarrow$ Reg[x1] + 4
B $\leftarrow$ Reg[x2] + 8
+2 Sumadores
**LL:** REUTILIZA MD
A' $\leftarrow$ MD[A]
B' $\leftarrow$ MD[B]
**EX:** REUTILIZA ALU
Si A' == B':
PC $\leftarrow$ PC + etiq
Si no:
PC $\leftarrow$ PC4
# <mark style="background: #FFF3A3A6;">TEMA 2: Jerarquía de memoria</mark>
## <mark style="background: #ADCCFFA6;">1. Introducción</mark>
### <mark style="background: #D2B3FFA6;">- Justificación</mark>
Existen mayores cantidades de memoria y la diferencia de velocidad entre procesador y memoria degrada el rendimiento del procesador. Si la memoria es veloz y de gran tamaño, su coste aumenta mucho. $Coste=K·tamaño$ donde $K$ es una constante que según la tecnología, determina la velocidad.
Hay una jerarquía de memoria, donde se combinan varios tipos de memoria:
- Pequeño tamaño y gran velocidad
- Gran tamaño y poca velocidad
MC (Memoria Caché) -> SRAM: poca capacidad, muy veloz, muy costosa. (CPU)
MP (Memoria Principal) -> DRAM: capacidad, velocidad y coste medios. (CPU)
MS (Memoria Secundaria): gran capacidad, poco veloz, poco costosa. (SO $\rightarrow$ Archivo de paginación/Partición SWAP)
El procesador emite la dirección de memoria:
- **Se comprueba si el dato a buscar está en MC.**
- Está $\Rightarrow$ Acierto. Se pasa a CPU.
- No está $\Rightarrow$ Fallo. Se propaga petición a nivel inferior.
- **Se comprueba si el dato está en MP.**
- Está $\Rightarrow$ Acierto. Se transfiere un bloque (conjunto de palabras) de datos a MC
- No está $\Rightarrow$ Fallo. Se propaga petición a nivel inferior.
- **Se comprueba si el dato está en MS.**
- Está $\Rightarrow$ Acierto.
- No está $\Rightarrow$ Fallo.
### <mark style="background: #D2B3FFA6;">- Funcionamiento</mark>
Hay varios principios:
- **Localidad:**
- Temporal: Si se accede a un dato, la probabilidad de que se acceda a ese mismo dato en un corto intervalo de tiempo es muy alta.
- Espacial: Si se accede a un dato, la probabilidad de que se acceda a un dato cercano es muy alta.
- **Inclusión:** Si un dato está en un nivel, también lo estará en todos los inferiores.
- **Coherencia:** Si se modifica un dato en un nivel, eventualmente, se modificará en los niveles inferiores.
### <mark style="background: #D2B3FFA6;">- Rendimiento</mark>
- **Acierto (hit):** Al buscar un dato, este existe en el nivel de memoria en el que se busca.
- Tasa de aciertos (HR $\rightarrow$ _Hit Rate): $HR=nº~aciertos/nº~accesos=1-MR$
- **Fallo (miss):** Al buscar un dato, este no existe en dicho nivel.
- Tasa de fallos (MR $\rightarrow$ _Miss Rate_): $MR=nº~fallos/nº~accesos$
Tiempo de acceso medio: de media cuánto se tarda en acceder a un dato en memoria.
$$
\begin{equation}
T_{acceso}=t_{hit}+MR·P_{miss}
\end{equation}
$$
$$
\begin{equation}
P_{miss}=T_{acceso,~N-1}+t_{transferencia}
\end{equation}
$$
$$
\begin{equation}
t_{transferencia}=tam.~bloque~·~v_{transferencia}
\end{equation}
$$
Donde:
- $t_{hit}\equiv$ tiempo de hit o tiempo que se tarda en acceder al dato en el nivel superior.
- $MR\equiv$ tasa de fallos.
- $P_{miss}\equiv$ penalización por fallo o tiempo perdido si se produce un fallo.
- $t_{transferencia}\equiv$ tiempo de transferencia.
- $v_{transferencia}\equiv$ velocidad de transferencia.
## <mark style="background: #ADCCFFA6;">2. Memoria caché</mark>
Almacén temporal de bloques de MP.
### <mark style="background: #D2B3FFA6;">- Estructura básica (MC - MP)</mark>
| línea | bits de control | bloque |
| ----------- | --------------- | ------ |
| L0 | | |
| L1 | | |
| L2 | | |
| L3 | | |
| .<br>.<br>. | | |
**$\uparrow$ MC $\uparrow$**
| bloque | <-- 8B --> |
| ----------- | ---------- |
| B0 | |
| B1 | |
| B2 | |
| B3 | |
| .<br>.<br>. | |
| B$2^{29}-1$ | |
**$\uparrow$ MP $\uparrow$**
Dada una dirección de memoria de 32 bits $\rightarrow [31:0]$, esta se interpreta en dos campos:
- Nº bloque $\rightarrow [31:3]$
- Desplazamiento de bloque $\rightarrow [2:0]$
**Ejemplo: bloques de $8B=2^3B$**
Capacidad máxima de direccionamiento $\rightarrow 2^{32}B$
Hay $2^{29}$ bloques.
### <mark style="background: #D2B3FFA6;">- Políticas según estructura y funcionamiento</mark>
#### <mark style="background: #FF5582A6;">EJEMPLO:</mark>
Bus de direcciones 32b $\rightarrow 2^{32}B\rightarrow$ tamaño MP
MC de 1KB map. directo
Bloques 16B $\rightarrow2^4B$
$2^{32}/2^4=2^{28}$ bloques en MP
dirección de MP $[31:0]$ bits:
- Nº bloque: $[31:4]$ bits
- Desplazamiento bloque: $[3:0]$ bits
dirección ejemplo: $0xAAB38$:
- Nº bloque: AAB3
- Desplazamiento: 8
$2^{10}/2^4=2^6$ bloques (por tanto líneas) en MC
dirección de MC $[31:0]$ bits:
- Etiqueta: $[31:10]$ bits
- Índice de línea: $[9:4]$ bits
- Desplazamiento de bloque: $[3:0]$ bits
dirección ejemplo: $0xAAB38=1010~1010~1011~0011~1000$:
- Etiqueta: $1010~1010~10$
- Índice de línea: $11~0011$
- Desplazamiento: $1000$
#### • Políticas de localización
Hay tres tipos distintos de memoria caché.
- **MC de mapeado directo:** un bloque de MP se ubicará en una línea concreta de MC. Utiliza el módulo (%) como función de correspondencia.
$nº~bloque~\%~nº~líneas=ubicación~del~bloque~en~MC$
Para interpretar la dirección de memoria:
- **Bit de válido (V):**
- **Etiqueta:**
- **Índice de línea:** puntero que apunta al número de línea.
- **Desplazamiento de bloque:**
dir $\rightarrow$ índice de línea $\rightarrow$ línea MC $\rightarrow$ se comprueba V:
- si $V=0$ no hay nada útil, si $V=1$:
- si $etiqueta~!=$ no es el bloque que quiero acceder $\rightarrow$ FALLO
- si $etiqueta==~\rightarrow$ ACIERTO
Los **pros** son que es muy rápida al localizar/ubicar y necesita muy poco hardware.
El único **contra** que tiene es una alta tasa de fallos (MR).
- **MC totalmente asociativa:** un bloque de MP se puede ubicar en cualquier línea de MC. No se usa función de correspondencia para ubicar los bloques, se usa únicamente el bit de
válido (V) $\rightarrow$ en el primer $V=0$ ahí se ubica.
La dirección de memoria se interpreta:
- **Etiqueta**
- **Desplazamiento de bloque**
El único **pro** que tiene es que tiene una baja tasa de fallos (MR).
Los **contras** son que necesita mucho hardware, es muy lenta y que necesita espacio adicional.
- **MC asociativa por conjuntos de $N$ vías:** un bloque de MP se puede ubicar en un subconjunto de líneas de tamaño $N$. Se trata básicamente de $N$ "cachés" en paralelo en las cuales se especifica el conjunto $C_n$ y dentro de ese conjunto se elige el subconjunto ("caché") correspondiente. Se vuelve a usar como función de correspondencia el módulo ($\%$) para elegir el subconjunto.
Para interpretar las direcciones de memoria:
- **Etiqueta**
- **Índice de conjunto**
- **Desplazamiento de bloque**
Para saber el número de conjuntos se hace igual que mapeo directo excepto que:
$2^{10}/2^4=2^6$ líneas $\rightarrow 2^6/2^2$ (líneas) $=2^4$ conjuntos
#### • Políticas de escritura:
Hay dos:
- **Frente a acierto:**
- Write-Through (WT): modifica el bloque en MC y en MP. Es **más lento** pero **mantiene la coherencia**.
- Copy-Back (CB): sólo modifica la MC. Es **más rápido** pero **mantiene una incoherencia temporal**. Surge un nuevo bit de control **D (Dirty)**, cuya función es indicar si está modificado el dato **' 1 '** o si no lo está **' 0 '**. Antes de colocar el bloque en MC desde MP, se comprueba el bit **D**, y si este se encuentra a **' 1 '**, se actualiza el bloque que se quiere sustituir desde MC a MP y luego se coloca el bloque nuevo en MC.
- **Frente a fallo:**
- Write-Allocation (WA): copia el bloque de MP a MC.
- No Write-Allocation (NWA): modifica directamente en MP.
#### • Políticas de reemplazo:
Sólo se aplican a cachés con asociatividad cuando se produce el fallo y el conjunto está lleno. Las más conocidas son:
- **Aleatoria:** Sustituye un bloque al azar. Muy utilizada.
- **LRU (Less Recently Used):** Se sustituye el bloque que más tiempo lleva sin usarse. Alto coste.
- **FIFO (First-In First-Out):** Se sustituye el bloque que más tiempo lleva en caché.
- **LFU (Less Frequently Used):** Se sustituye el bloque que se usa menos veces.
### <mark style="background: #D2B3FFA6;">- Tipos de MC</mark>
Según la información:
- **Unificada:** es única para instrucciones y datos. Las etapas IF y MEM acceden a la misma caché. La **ventaja** es que balancea el espacio dedicado a instrucciones y datos (menos fallos) pero la **desventaja** es que como no se puede acceder a instrucciones y datos simultáneamente, habrán ciclos de bloqueo.
- **Separada:** cachés separadas para instrucciones y datos. Hay acceso simultáneo a IF y MEM. El **inconveniente**es que al fijar el tamaño dedicado a instrucciones y datos no se equilibra la carga (ligeramente más fallos).
Para mejorar el rendimiento se debe reducir el $T_{acceso}$ . Se puede conseguir reduciendo la frecuencia de fallos (menor frecuencia de fallos), las penalizaciones por fallo (menor tiempo en transferir un bloque) o el tiempo de acierto (menor tiempo en acceder a caché).
## <mark style="background: #ADCCFFA6;">3. Tipos de fallos</mark>
### <mark style="background: #D2B3FFA6;">- Fallo forzoso</mark>
Se producen cuando el bloque nunca ha sido cargado en memoria. También conocido como de arranque en frío. Habrá más fallos forzosos con bloques pequeños debido al principio de localidad espacial. Se reducen aumentando el tamaño de bloque.
### <mark style="background: #D2B3FFA6;">- Fallo por capacidad</mark>
Se producen cuando la caché se llena. Se reduce aumentando la caché.
### <mark style="background: #D2B3FFA6;">- Fallo por conflicto</mark>
Se produce cuando el número de bloques en memoria accedidos y que están en un mismo conjunto de caché, es mayor a la asociatividad de la caché. Sólo ocurre en mapeado directo o por conjuntos. Se reducen aumentando la asociatividad.
## <mark style="background: #ADCCFFA6;">4. Distintos niveles de MC</mark>
Añadir nuevos niveles a caché para reducir aún más los accesos a MP. Para 3 niveles sería así:
- CPU accede a L1, en caso de fallo a L2, en caso de fallo a L3...
- Los fallos de L1 serán accesos a L2, los fallos de L2 serán accesos a L3...
- El fallo producido en cada nivel de cachés es:
- $ff_{L1}=\frac{L_{1-2}}{Acc}$
- $ff_{L2}=\frac{L_{2-3}}{L_{1-2}}$
- $ff_{L1}=\frac{F}{L_{2-3}}$
Dando lugar a una tasa de fallos global como la siguiente:
$ff_{Global}=ff_{L1}·ff_{L2}·ff_{L3}$
# <mark style="background: #FFF3A3A6;">TEMA 3: Entrada y Salida</mark>
## <mark style="background: #ADCCFFA6;">1. Introducción</mark>
![[Imagen de WhatsApp 2024-04-29 a las 21.27.14_7678cee1.jpg|400]]
### <mark style="background: #D2B3FFA6;">- Justificación</mark>
La misión principal del módulo E/S es adaptar los dispositivos externos para su conexión al bus del sistema. No se pueden conectar directamente por varias razones:
- A menudo la velocidad de los dispositivos externos es menor que la de la memoria y CPU.
- Hay muchísimos periféricos como para adaptar toda la lógica que hace falta para todos.
- Los formatos y tamaños de datos suelen ser distintos en el periférico y en el computador.
## <mark style="background: #ADCCFFA6;">2. Módulo de E/S</mark>
Dentro del módulo hay **controladores** que son módulos E/S sencillos con el hardware mínimo para que el dispositivo funcione y **canales o procesadores E/S**, que son procesadores con su set de instrucciones orientado a E/S.
**Periférico**: Dispositivo externo + módulo E/S
Un módulo E/S contiene varios registros (generalmente de 8b). Hay tres tipos
- **Estado:** Nos da información del estado del dispositivo.
- **Control:** Solicita operaciones al dispositivo
- **Datos:** L/E
## <mark style="background: #ADCCFFA6;">3. Tipo de E/S</mark>
### <mark style="background: #D2B3FFA6;">- Según conexión con el sistema</mark>
#### <mark style="background: #FFB86CA6;">E/S Separada</mark>
![[Imagen de WhatsApp 2024-04-29 a las 21.42.39_5d0c4006.jpg|350]]
El acceso a E/S se realiza a través de un espacio de direcciones diferente al de memoria. <u>Ejemplo:</u> la arquitectura IA32 dispone de un espacio de direccionamiento E/S de 16b al que se accede con instrucciones `IN` `OUT`.
#### <mark style="background: #FFB86CA6;">E/S Mapeada</mark>
![[Imagen de WhatsApp 2024-04-29 a las 21.47.52_c51a3dca.jpg|350]]
El acceso a E/S se realiza a través de un espacio de direcciones mapeado en memoria. A los periféricos se les asignan posiciones de memoria como si fueran variables. <u>Ejemplo:</u> RISC, Motorola 68000.
Las **ventajas** de la E/S mapeada son que la UC es más sencilla, que es más rápida y que el ISA es más sencillo. Las **desventajas** son que el espacio de memoria se comparte, que hay que optimizar el código y que hay que tener cuidado con la MC (una forma de arreglar los errores con MC es configurar el espacio de direcciones ocupado por dispositivos como **no cacheable** evitando el uso de MC para estas direcciones).
#### <mark style="background: #FFB86CA6;">E/S Mapeada VS E/S Separada / Ejercicios</mark>
| E/S Mapeada | E/S Separada |
| ----------------------------------------------------------------------- | ------------------------------------------------- |
| Ensamblador (RISC-V):<br>`load/store`<br>$\uparrow$ Práctica $\uparrow$ | C:<br>`inb/outb`<br>$\uparrow$ Teoría $\uparrow$ |
##### Ejercicio 1
<hr>
Control (dirbase + 0) -> Escribir "S"
Estado (dirbase + 1) -> Si el MSB == 1 -> Lectura disponible
Datos (dirbase + 2)
1. Escribir S en control
2. Comprobar si MSB == 1
- Leer registro de datos
### <mark style="background: #D2B3FFA6;">- Según comunicación con el procesador</mark>
De abajo a arriba:
- $\uparrow$ dependencia CPU
- $\downarrow$ coste
- $\downarrow$ HW necesario
#### <mark style="background: #FFB86CA6;">E/S programada (polling o sondeo)</mark>
El procesador tiene el control absoluto en la comunicación.
![[IMG-20240601-WA0014.jpg|300]]
1. El procesador configura el módulo E/S. (Registro de control)
2. Consulta constante del estado del dispositivo. (Registro de estado)
3. El procesador lee el dato. (Registro de datos)
Las **ventajas** son que no necesita hardware adicional y que es muy rápido ya que está continuamente esperando a que el estado del del dispositivo cambie. Como **inconvenientes**, el procesador sólo está pendiente del estado del dispositivo.
##### Ejercicio
<hr>
Sean los registros RE (estado), RC (control) y RD (datos). Donde:
![[IMG-20240601-WA0021.jpg|200]]
- B = Busy
- R = Solicitar lectura
- D = Data ready
```C
unsigned char res;
while((inb(0x100) & 0x01) != 0); // Esperar que el dispositivo no esté ocupado
outb(inb(0x101) | 0x01, 0x101); // Solicitar lectura
while((inb(0x100) & 0x80) == 0); // Esperar que el dato esté disponible
res = inb(0x102);
```
#### <mark style="background: #FFB86CA6;">E/S por Interrupciones</mark>
![[IMG-20240601-WA0017.jpg|300]]
Hay dos tipos de interrupciones:
- **Hardware:** Se producen por la CPU o por E/S.
- Internas: Generadas por la CPU, comúnmente conocidas como Excepciones.
- Externas: Generadas por E/S.
- Vectorizables: se usa un vector (o identificador). <mark style="background: #ABF7F7A6;">Daisy chain (consulta hardware)</mark>, <mark style="background: #ABF7F7A6;">Arbitraje del bus</mark>.
- No vectorizables (autovectorizadas): la CPU identifica por sí misma quién ha generado la interrupción. <mark style="background: #ABF7F7A6;">Múltiples líneas de INT</mark>, <mark style="background: #ABF7F7A6;">Consulta software</mark>.
- **Software:** Relacionadas con el S.O.
Se le otorga al módulo E/S la capacidad de avisar al procesador cuando finalice una tarea, evitando las esperas activas.
1. El procesador configura el módulo E/S. (Registro de control)
2. El procesador cambia de contexto y el módulo E/S transfiere información con el dispositivo E/S.
3. Módulo E/S lanza interrupción.
4. El procesador atiende la interrupción.
5. El procesador ejecuta la RSI (Rutina Servicio de Interrupción).
La **ventaja** es que no hay espera activa. Los **inconvenientes** son que hace falta más hardware y es más lento en atender al módulo E/S.
##### <mark style="background: #FF5582A6;">Implementaciones</mark>
Surgen **4 implementaciones** al tener varios dispositivos E/S. ¿Cómo identificar el dispositivo que lanza la interrupción? ¿Prioridad al tener varios dispositivos interrumpiendo a la vez?
- <mark style="background: #ABF7F7A6;">Múltiples líneas de interrupción:</mark>
![[IMG-20240601-WA0019.jpg|400]]
Se identifica el dispositivo E/S mediante la línea de interrupción que se haya activado. La prioridad de los dispositivos se maneja según la CPU lea las señales. Como **inconveniente**: número limitado de dispositivos E/S. Como **ventaja**: identificar el dispositivo es muy sencillo.
- <mark style="background: #ABF7F7A6;">Consulta software:</mark>
![[IMG-20240601-WA0020.jpg|400]]
![[IMG-20240601-WA0015.jpg|400]]
Si se activa INT, se ejecuta una rutina de interrupción general. Se identifica el dispositivo E/S mediante lectura de registros de estado del módulo E/S. La prioridad se maneja por orden de lectura del estado. Como **ventaja**: no hay límite de dispositivos E/S. Como **inconveniente**: más lento, ya que se tienen que leer todos los registros de estado.
- <mark style="background: #ABF7F7A6;">Consulta hardware (daisy chain):</mark>
![[IMG-20240601-WA0018.jpg|400]]
- El módulo E/S activa INT
- El procesador atiende la interrupción y activa INTA.
- El módulo que haya generado la interrupción escribe su vector de interrupción (VI) en el bus de datos.
- El procesador ejecuta el código correspondiente al VI.
- El módulo E/S desactiva INT.
- El procesador desactiva INTA.
Se identifica al dispositivo E/S mediante el VI. Y la prioridad es en orden de lectura.
Como **ventajas**: tantos dispositivos E/S como quiera, mucho más rápido que consulta software. Como **inconveniente**: mucho más hardware necesario.
- <mark style="background: #ABF7F7A6;">Arbitraje del bus:</mark>
![[IMG-20240601-WA0016.jpg|400]]
- El módulo de E/S pide acceso al bus de datos.
- El módulo de E/S activa INT si está libre.
- El procesador activa INTA.
- El módulo E/S envía al procesador su VI.
La prioridad la define el arbitrador (que puede ser todo lo complejo que quiera).
#### <mark style="background: #FFB86CA6;">E/S por DMA</mark>
La CPU "se desentiende" de la E/S. Aparece el **Controlador DMA (DMAC)**.
![[Imagen de WhatsApp 2024-06-07 a las 12.39.53_81ad7889.jpg|400]]
1. CPU configura DMAC.
- Indica al DMAC la dirección de memoria del módulo E/S.
- Indica la operación a realizar (R/W).
- Indica el tamaño de los datos (nº palabras a transferir).
- Especifica la dirección de memoria inicial.
2. CPU configura módulo E/S.
![[Imagen de WhatsApp 2024-06-07 a las 12.42.14_b5d9a85f.jpg|400]]
3. CPU cambia de contexto.
4. DMAC y E/S transfieren información (hasta que Cuenta sea 0):
4.1. Módulo E/S activa DMA_REQ
4.2. DMAC lee el dato y lo guarda en el registro Dato
4.3. DMAC activa DMA_ACK
4.4 DMAC pone la dirección en el Bus de Direcciones y el dato en el Bus de Datos y activa la escritura en memoria.
4.5. DMAC actualiza la dirección y la cuenta (restando 1).
4.6. DMAC desactiva DMA_ACK y el módulo E/S desactiva el DMA_REQ.
5. DMAC manda interrupción a CPU (activa TC)
Puede llegar a haber conflictos al usar la CPU y el DMAC los mismos AB y DB.
##### <mark style="background: #FF5582A6;">Implementaciones</mark>
1. <mark style="background: #ABF7F7A6;">Memoria multipuerto</mark>
![[Imagen de WhatsApp 2024-06-07 a las 12.44.18_4894e2e8.jpg|400]]
No se usa porque es costosa.
2. <mark style="background: #ABF7F7A6;">Arbitraje del bus</mark>
![[Imagen de WhatsApp 2024-06-07 a las 12.50.01_654ee200.jpg|400]]
- Módulo E/S avisa a CPU dato disponible.
- Pregunta a CPU si bus disponible.
- Si CPU activa HOLD_ACK, DMAC, avisa a E/S.
Hay varias implementaciones
1. **Ráfaga:** DMAC tiene acceso al bus hasta que termine todas las transferencias.
2. **Robo de ciclo:** DMAC sólo tiene acceso durante un ciclo. (fly_by $\rightarrow$ E/S escribe directamente en Memoria).
3. **Transparente:** DMAC sólo tiene acceso cuando CPU no utiliza el bus.
### EJERCICIO 5
<hr>
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| --- | --- | --- | --- | --- | --- | --- | --- |
| | | | | | | | |
c)
```C
#define R 0x0f
while((inb(R) & 0x08)!=0);
outb(((inb(R) & 0x10) >> 2) | (inb(R) & 0xfb),R);
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -0,0 +1,615 @@
# ==TEMA 1: Esquemas iterativos y recursivos==
Tipos de ejercicio:
## 1.1. Notación teórica
- **Rangos:** `[a,b), [a,b] -> [1,5) = 1,2,3,4`
- **Progresión aritmética:** La diferencia entre dos términos consecutivos es siempre la misma. Ejemplo: 1,3,4,7,10,13,16...
- **Progresión geométrica:** La diferencia entre dos términos varía. Ejemplo: 1,2,4,8,16,32...
- **Tuplas:** `t = (t0, t1, ..., tn-1) -> Records (inmutables)`
- **Listas:** `ls = [e0, e1, ..., en-1] -> |ls|, ls[i, j], ls[i], []`
- **Conjunto:** `ss = {e0, e1, ..., en-1} -> |ss|, {}`
- **Diccionarios:** `m = {k0:v0, k1:v1, ..., kn-1:vn-1} -> m[ki]`
- **Multiconjuntos:** `ms = {e0:m0, e1:m1, ..., en-1:mn-1}`
- **Agregados de datos:** `d -> reales, virtuales`
- **Reales:** en todo momento podemos disponer de cualquier elemento. Almacenados en MEMORIA.
- **Virtuales:** sus elementos se proporcionan bajo demanda, es decir, inicialmente está vacío. Ejemplo: `Stream<>, Iterator<>`
## 1.2. Factorías de secuencias
- **Range:**
Se trata de una progresión aritmética.
`range(a,b) = (a, e -> e < b, e -> e + 1)`
- **Iterate:**
Se trata de una progresión geométrica donde `e0` es el valor inicial, `g` es el `Predicate` y `nx` la "función next".
`iterate(e0, g, nx) = (e0, e -> g(e), e -> nx(e))`
## 1.3. Operaciones sobre secuencias
- **Prefijo:**
Se queda con los consecutivos que cumplen un `Predicate`.
`s2 = s1.takeWhile(p);`
- **Sufijo:**
Descarta los consecutivos que cumplen un `Predicate`.
`s2 = s1.dropWhile(p);`
- **Concatenar:**
Concatena dos secuencias.
`concat(s1, s2);`
- **Enumerate:**
Parejas de elementos de una `Sequence` y sus posiciones.
`(e: i)`
## 1.5. Transformación de algoritmos
- **Paso 1:**
Identificar los elementos principales (`e0`, `b0`, `nx`, `g` …).
- **Paso 2:**
Pasar del método original a la llamada inicial y recursiva.
Al usar la "función cortocircuito" aparece el acumulador secuencial:
`a = (b0, (b,e) -> c(b,e), b -> r(b), b -> d(b))`
Y un acumulador simple es cuando no tiene ni "función retorno" ni "función cortocircuito":
`a = (b0, (b,e) -> c(b,e)`
## 1.6. Acumuladores
- **`allMatch(p): `**`(true, (b,e) -> p(e), b -> b, b -> !b)`
$b_0$ = `true` ; `c(b,e)`= `p(e)` ; no hay `r(b)` ; `d(b)`= `!b`
_Ejemplo:_ `IntStream.range(15,75).filter(e->e%3==2).allMatch(e->e%2==1)`
`s = (15, e -> e < 75, e -> e + 1)`
`a = (true, c(b,e) -> b = e % 2 == 1, b -> b, b -> !b)`
```java
Integer e = 15;
Boolean b = true;
while(e < 75 && !d(b)) { // d(b) = !b entonces queda !!b = b
if(e % 3 == 2) {
b = e % 2 == 1;
}
e = e + 1;
}
return b; // no hay r(b)
```
- **`anyMatch(p):`**`(false, (b,e) -> p(e), b -> !b, b -> b)`
- **`noneMatch(p):`**`(false, (b,e) -> p(e), b -> b, b -> b)`
- **`sum():`**`(0, (b,e) -> b + e)`
- **`count():`**`(0, (b,e) -> b + 1)`
- **`joining(sp,pf,sf):`**
`B = (String,Boolean), E = R = String`
`a = ((pf, true), ((b1,b2),e) -> c((b1,b2),e), (b1,b2) -> b1 + sf, b -> false)`
```java
String b1 = "*";
Boolean b2 = true;
Integer i = 0;
while(i < ls.size()) {
if(b2) {
b1 += ls.get(i);
b2 = false;
} else {
b1 += ":"+ls.get(i);
}
i++;
}
return b1 + "#";
```
- **`findLast:`**``
- **`ToList, ToSet, ToMultiset:`**``
- **`AllDifferents, Frequency:`**``
- **`GroupsSize:`**`s.collect(Collectors.groupingBy()`
- **`GroupingList, GroupingSet:`**`s.collect(Collectors.groupingBy()`
- **`GroupingReduce:`**`s.collect(Collectors.groupingBy()`
Ejemplo3Java8
```java
s = (0, i -> i < ls.size(), i -> i + 1);
B = Boolean;
a = (true, (b,i) -> ls.get(i) % 2 == 1, b -> b, b -> !b);
```
## 1.7. El tamaño del problema
- El tamaño se denota mediante la letra $n$ , siendo $n >= 0$ .
- $n = f(\vec{x})$ , siendo $\vec{x}$ las propiedades del problema. (Ejemplo: en problemas de secuencias, $n = b - a$ , siendo $a$ y $b$ los extremos de la secuencia)
- Nos interesará calcular el tiempo en función del tamaño (complejidad): $T(n)$ .
- En un algoritmo bien construido, el tamaño disminuirá a medida que el algoritmo avanza hacia la solución.
- A partir de la versión funcional, $n$ se obtiene muy fácilmente.
## 1.8. Diseño de algoritmos iterativos
Obtener un algoritmo a partir de un enunciado. Hay varias estrategias de diseño:
- **Algoritmo iterativo:**
1. Hallar la secuencia `s` y el acumulador `a` para el problema.
2. Generalizar el problema.
- **Algoritmo recursivo:**
1. Encontrar una definición a partir de un conjunto de propiedades.
2. Definir una función de partición.
3. Generalizar el problema.
4. Definir una restricción E/S.
### ♦ Algoritmos iterativos - Estrategia 1
Obtenidos `s` y `a` implementamos el algoritmo en estilo:
Funcional $\rightarrow$ Aplicando los esquemas $\rightarrow$ Imperativo $\rightarrow$ Recursivo Final
Es necesario que la secuencia `s` sea finita y que si `s` no es indexable, la transformación se realice mediante iteradores.
#### Ejemplo 1: Número primo más pequeño mayor a un número n.
$e_0~=~n~\%~2~==~0~?~n~+~1~:~n~+~2$
$nx(e)=e\rightarrow e+2$
$g(e)=e\rightarrow true$
```java
Long siguientePrimo1(Long n) {
Long e0 = n%2 == ? n+1 : n+2;
return Stream.iterate(e0, e -> e+2)
.filter(e -> Math2.esPrimo(e))
.findFirst()
.get();
}
```
$s=(n\%2~==~0~?~n+1~:~n+2,~e\rightarrow true,~e\rightarrow e+2$
$a=(null,~b=esPrimo(e)~?~e~:~null,~b\rightarrow e,~b\rightarrow b!=null)$
#### Ejemplo 2: Dado un fichero de números enteros en cada línea separados por comas y espacios, sumar los que sean primos.
```csv
numeros.csv
1,2,3,4
5,6,7,8
9,10,11,12
13,14,15,16
```
```java
Integer sumaPrimos(String file) {
IntStream st = Streams.file(file)
.flatMap(e -> Streams.split(e,"[ ,]"))
.mapToInt(e -> Integer.parseInt(e))
.filter(e -> Math2.esPrimo(e));
return st.sum();
}
```
### ♦ Algoritmos iterativos - Estrategia 2
Consiste en concretar un estado y sobre él definir un invariante. Un estado es una tupla (record) cuyas componentes dan la información necesaria sobre cómo progresa el algoritmo hacia la solución del problema.
Definir la tupla-estado se denomina generalizar el problema. El algoritmo pasa de un estado inicial a un estado final mediante una sucesión de estados. El invariante previamente definido es el predicado que debe cumplirse en todos los estados.
#### Ejemplo 1: Encontrar el n-ésimo termino de la sucesión de Fibonacci.
$$
fb(n)=
\left
\lbrace
\begin{array}{c}
d_0,~n=0 \\ d_1,~n=1 \\ a*fb(n-1)+b*fb(n-2),~n>1
\end{array}
\right.
$$
#### Ejemplo 2: Dada una lista `ls`, ordenada con respecto a un orden, y un elemento `e`, devolver el índice de `e` en `ls` ó `-1` si no está.
```java
Integer n = ls.size();
(i,j,k) = (0, n, n/2);
while(j-i > 0 && ls.get(k)!=e) {
(i,j,k) = ver (1)
}
return r((i,j,k));
```
$$
^{(1)}~(i,j,k) =
\left
\lbrace
\begin{array}{c}
(k,j,\frac{k+j}{2}), ls[k] < e \\
(i,k,\frac{i+k}{2}), ls[k] > e
\end{array}
\right.
$$
## 1.9. Diseño de algoritmos recursivos
### ♦ Algoritmos recursivos - Estrategia 1
Dado un conjunto de propiedades, diferenciar aquellas necesarias y suficientes que proporcionan una definición recursiva. Es necesario determinar las propiedades que determinan los casos base y las que permiten llegar a ellos. Hay que tener en cuenta que algunas propiedades pueden necesitar ser reescritas.
$$
\binom{n}{k} =
\left
\lbrace
\begin{array}{c}
1,~~~k, n-k = 0 \\ n,~~~k,n-k=1 \\ \binom{n-1}{k-1}+\binom{n-1}{k},~~~k>1
\end{array}
\right.
$$
```java
public static BigInteger binom(Long n, Long k) {
BigInteger r;
if(k==0 || n-k==0) {
r = BigInteger.ONE;
} else if(k==1 || n-k==1) {
r = new BigInteger(n.toString());
} else if(k>1) {
r = binom(n-1,k-1) + binom(n-1,k);
}
return r;
}
```
### ♦ Algoritmos recursivos - Estrategia 2
Asumimos que el tipo $D$ tiene un método `size()` que indica su tamaño.
```java
ls = [2,4,6,8,10]
View1<Integer> v1 = List2.view1(ls);
// v1 = (2, [4,6,8,10])
View2<Integer> v2 = List2.view2(ls);
// v2 = ([2,4], [6,8,10])
View2E<Integer> v3 = List2.view2e(ls);
// v3 = (6, [2,4], [6,8,10])
```
### ♦ Algoritmos recursivos - Estrategia 3
- **Opción 1:**
- **Opción 2:**
Consideramos dos esquemas según el tipo de problema, aplicables únicamente a secuencias indexables.
- **Generalización sufija (reduce y vencerás):** Si `s` es la secuencia original, cada nuevo subproblema `(i,s)` lo conforman los elementos de `s` cuyos elementos cumplen $\geq$ `i`.
- **Generalización central (divide y vencerás):** Si `s` es la secuencia
### ♦ Algoritmos de ordenación: Bandera Holandesa
Sea una lista `List<T>` y un elemento tipo `T` llamado pivote. Se establecen 3 "banderines" `a`, `b` y `c`. Los banderines `a` y `b` se van desplazando hacia la derecha y `c` hacia la izquierda. Cuando `b` y `c` se encuentran, se ha terminado. $BH\rightarrow\Theta(n)$
### ♦ Algoritmos de ordenación: QuickSort
Los intervalos son $[0,a)$, $[a,b)$, $[b,n)$. Tiene una complejidad $\Theta(n·\log{n})$ oscilante entre eso y $n^2$ en el peor de los casos (si los pivotes caen en los extremos al ser aleatoriamente escogido).
### ♦ Algoritmos de ordenación: MergeSort
Los intervalos son $[0,a)$, $[a,b)$, $[b,n)$. Tiene una complejidad $\Theta(n·\log{n})$ oscilante entre eso y $n^2$ en el peor de los casos (si los pivotes caen en los extremos al ser aleatoriamente escogido). $MS\rightarrow\Theta(n·\log{n})$
### ♦ Algoritmos de ordenación: K-ésimo
Dada una lista se quiere saber la posición de un elemento `e` si la lista estuviera ordenada. A la lista se le aplica la Bandera Holandesa $T(n)=n+T(\frac{n}{2})$ .
# ==TEMA 2: Recursividad múltiple==
## 2.1. Recursividad múltiple sin memoria
$$
f(a,b)=
\left
\lbrace
\begin{array}{c}
a+b,~a<2~∧~b<3 \\ a*b,~a<3~~b<4 \\ f(a-1,b/2),~a<5~~b<5 \\ f(a/2,b-3),~e.o.c
\end{array}
\right.
$$
```java
Long f(Integer a, Integer b) {
Long r = null;
if(a < 2 && b < 3) {
r = a + b;
} else if(a < 3 || b < 4) {
r = a * b;
} else if(a < 5 || b < 5) {
r = f(a-1, b/2) + f(a-2, b/4);
} else {
r = f(a/2, b-3) - f(a/3, b-1);
}
return r;
}
```
## 2.2. Recursividad múltiple con memoria
```java
Long fInit(Integer a, Integer b) {
return f(a, b Map2.empty());
}
Long f(Integer a, Integer b, Map<IntPair, Long> m) {
if(m.containsKey(IntPair.of(a,b))) {
r = m.get(IntPair.of(a,b));
} else {
if(a < 2 && b < 3) {
r = a + b;
} else if(a < 3 || b < 4) {
r = a * b;
} else if(a < 5 || b < 5) {
r = f(a-1, b/2, m) + f(a-2, b/4, m);
} else {
r = f(a/2, b-3, m) - f(a/3, b-1, m);
}
m.put(IntPair.of(a,b), r);
}
return r;
}
```
# ==TEMA 3: Análisis de la complejidad y eficiencia==
## 3.1. Análisis de la complejidad
Analizar la complejidad de un algoritmo es el estudio del tiempo que tarda en ejecutarse en función del tamaño de problema que se está resolviendo. Se representa mediante $T(n)$, que es continua y creciente, siendo $n$ el tamaño del problema. Interesa analizar la complejidad cuando el tamaño del problema tiende a infinito. Hay varias relaciones de equivalencia:
- **Igualdad:** $f(n)=_\infty g(n)\leftrightarrow 0 < \lim\limits_{n\to\infty}\frac{h(n)}{g(n)}<\infty$
- **Relación de equivalencia:**
$\Theta(g(n))=\{f(n)|f(n)=_\infty g(n)\}$
$\Theta(g(n))=\{f(n)|\lim\limits_{n\to\infty}\frac{f(n)}{g(n)}=0$
- **Relación de orden:** $f(n)<_\infty g(n)\leftrightarrow \lim\limits_{n\to\infty}\frac{f(n)}{g(n)}=0$
- **Propiedades:** $\Theta(af(n)+bg(n))=\Theta(f(n))~si~f(n)>\infty g(n)$
Se denominan **instrucciones elementales** a la asignación, a evaluar expresiones lógicas y aritméticas, declaración de tipo de variable y a cualquier combinación de una/varias de las anteriores. Un **bloque básico** es una secuencia finita de instrucciones elementales. La complejidad de un bloque básico es de orden constante $\Theta(1)$.
## 3.2. Complejidad de sumatorios
![[Pasted image 20231009184410.png|400]]
## 3.3. Operaciones con enteros (Integer, Long, BigInteger)
- Número de dígitos $d(n)$ de un entero $n$: $\Theta(d(n))=\log{n}$
- Complejidad de la suma y multiplicación para enteros cortos: $\Theta(1)$
- Complejidad de la suma de enteros largos: $\Theta(d)$
- Complejidad de la multiplicación de dos enteros largos: $\Theta(d^k)$ sea $k=2$ para la multiplicación normal, $k=1.58$ para el algoritmo de _Karatsuba_ y $k=1.46$ para el de Tom-Cook.
- Complejidad de la multiplicación de un entero largo por un entero corto: $\Theta(d)$
### ♦ Potencia
- Propiedades:
$a^n=a^{n-1}$
$T(n)=T(n-1)+1$ : `BigInteger * Integer/Long`
$T(n)=T(n-1) + n^k$ : `BigInteger * BigInteger`
$a^n=({a^{n/2}})^2$ , si $n$ es par
$a^n=a·({a^{n/2}})^2$ , si $n$ es impar
- Si $a^n$, $a$ y $n$ son enteros cortos:
- No hay caso mejor y peor
- Primera opción: $\Theta(n)$
- Segunda opción: $\Theta(\log{n})$
- Si
#### ♦ Ejemplo 1
```java
Integer alg(Integer a) {
Integer r= 0, i=1;
while(i<=a) {
r+=i*i;
i+=2;
}
return r;
}
```
$\sum_{i\in pa(1,2)}^{n}~1=\sum_{x\in pa(1,2)}^{n}~x^d·\log^p{x}\Leftrightarrow 1=x^d·\log^p{x}\Leftrightarrow d=0, p=0$
Lo cual quedaría en: $T(n)_{bucle}=_\infty \frac{1}{2(0+1)}·n^{d+1}·\log^0{n}=\frac{n}{2}=_\infty n$
#### ♦ Ejemplo 2
```java
Integer alg(Integer a) {
Integer r= 0, x=1;
while(x<=a) {
r+=x*x;
i+=2;
}
return r;
}
```
Para $d=0, p=1;~T_{bucle}=\log{n}$
#### ♦ Ejemplo 3
```java
Integer alg(Integer a) {
Integer r = 0, x = a;
while(x>0) {
for(int y = 0; y < a; y++) {
r += x*y;
}
x = x/2;
}
return r;
}
```
$T_{bucleWhile}=\sum_{y\in pa(0,1)}^{n}~1=_\infty n$
$T_{bucleFor}=\sum_{x\in pa(n,1/2)}^{1}~n=n·\sum_{x\in pg(1,2)}^{n}~1=n·[~\sum_{x\in pg(1,2)}^{n}~x^d·\log^p{x}~]$
$\Leftrightarrow 1=x^d·\log^p{x}\Rightarrow d=0, p=0 \Rightarrow T_{bucleFor}=n·[~\log^{d+1}{n}~]=n·\log{n}$
#### ♦ Ejemplo 4
```java
Integer alg(Integer e) {
Integer r = null;
if(e<=2) {
r = e;
} else {
r = alg(e-1) + e*e;
}
return r;
}
```
$T(n)=T(n-1)+1=a·T(n-b)+n^d·\log^p{n}\Rightarrow a=1, b=1, d=0, p=0\Rightarrow \Theta(T(n))=n^{0+1}·\log^0{n}=n$
#### ♦ Ejercicio
<hr>
```java
Integer alg(Integer a, Integer b) {
Integer r = a;
if(b<=1) {
r+=b;
} else {
r+=alg(a*4,b-2)+alg(a*4,b-2);
}
return r;
}
```
1) $n = b$
2) $T(n)=T(n-2)+T(n-2)+1=2·T(n-2)+1=a·T(n-b)+n^d·\log^p{n}\rightarrow$ $\rightarrow a=2,~b=2,~d=0,~p=0$
3) $\Theta(T(n))=2^\frac{n}{2}·\log^0{n}=\sqrt{2}^n$
#### ♦ Ejercicio
<hr>
```java
Integer alg(Integer a, Integer b) {
Integer r = a;
if(b<=1) {
r+=b;
} else {
r+=alg(a*4,b-2)*2;
}
return r;
}
```
1) $n=b$
2) $T(n)=T(n-2)+1=1*T(n-2)+1=a·T(n-b)+n^d·\log^p{n}\rightarrow$
$\rightarrow a=1,~b=2,~d=0,~p=0$
3) $\Theta(T(n))=n^{0+1}·\log^0{n}=n$
#### ♦ Ejercicio
<hr>
```java
Integer alg(Integer a, Integer b) {
Integer r = a;
if(b<=1) {
r+=b;
} else {
r+=alg(a*4,b-2)*alg(a/2,b/2)-alg(a+1,b/2);
}
return r;
}
```
1) $n=b$
2) $T(n)=3·T(n-2)+1=a·T(\frac{n}{b})+n^d·\log^p{n}\rightarrow$
$\rightarrow a=3,~b=2,~p=d=0$
3) $\Theta(T(n))=n^{\log_2{3}}$
#### ♦ Ejercicio
<hr>
```java
Integer alg(Integer a, Integer b) {
Integer r = a;
if(b<=1) {
r+=b;
} else {
r+=alg(a*4,b/2)*alg(a/2,b/4)-alg(a+1,b/3);
}
return r;
}
```
1) $n=b$
2) $T(n)=T(\frac{n}{2})+T(\frac{n}{3})+T(\frac{n}{4})+1$
$T_1(n)=3T(\frac{n}{4})+1$
$T_2(n)=3T(\frac{n}{2})+1$
3) $3T(\frac{n}{4})+1=a·T(\frac{n}{b})+n^d·\log^p{n}\rightarrow$
$\rightarrow a=3,~b=4,~d=p=0$
$\Theta(T_1(n))=n^{\log_4{3}}$
$3T(\frac{n}{2})+1=a·T(\frac{n}{b})+n^d·\log^p{n}\rightarrow a=3,~b=2,~d=p=0$
$\Theta(T_2(n))=n·\log_2{3}$
#### ♦ Ejercicio
<hr>
```java
Integer alg(Integer a, Integer b) {
Integer r = a;
if(b<=1) {
r+=b;
} else {
for(int i = 1, i<=b*b; i*=2) {
r+=a;
}
r+=alg(a*2,b-2)+alg(a/2,b-1);
for(int j = 0; j*j<b; j++) {
r+=b;
}
}
return r;
}
```
1) $n=b$
2) $T(n)=T_{bucle1}+T(n-2)+T(n-1)+T_{bucle2}+1$
$T_{bucle1}=\sum_{i\in pg(1,2)}^{n^2}~1=n^d·\log^p{n}\rightarrow$
$\rightarrow d=p=0\Rightarrow T_{bucle1}=\log^{0+1}{n^2}=\log{n^2}=2·\log{n}=\Theta(\log{n})$
$T_{bucle2}=\sum_{j\in pa(1,1)}^{\sqrt n}~1\rightarrow 1={\sqrt{n}^d}·\log^p{\sqrt{n}}\rightarrow d=p=0 \Rightarrow$
$\Rightarrow T_{bucle2}=\frac{1}{1(0+1)}·{\sqrt{n}}^0+1·\log^0{\sqrt n}=\sqrt n$
3) $T_1(n)=2·T(n-2)+n^{\frac{1}{2}}\rightarrow a=2,~b=2,~d=\frac{1}{2},~p=0\Rightarrow$
$\Rightarrow \Theta(T_1(n))=2^{\frac{n}{2}}·\log^0{n}={\sqrt{2}}^n$
$T_2(n)=2·T(n-1)+n^{\frac{1}{2}}\rightarrow a=2,~b=1,~d=\frac{1}{2},~p=0$
$\Theta(T_2(n))=2^{\frac{n}{1}}·\log^0{n}=2^n$
$\Theta(2^{\frac{n}{2}})<_\infty\Theta(T(n))<_\infty\Theta(2^n)$
#### ♦ Ejercicio
<hr>
**Sin memoria**
1) $n=k$
2) c. mejor => Último elemento de v = -a
c. peor => Último elemento de v $\neq$ -a
3) $T(n)=T(n-1)+T(n-2)+T_{bucle}$
$T_{bucle}=\sum_{i\in pg(1,3)}^{n}\sum_{j\in pa(1,2)}^{i}~1=\sum_{i\in pg(1,3)}^{n}~i\Leftrightarrow\sum_{i\in pg(1,3)}~i^d·\log^p{i}\Rightarrow d=1, p=0\Rightarrow T_{bucle}=\Theta(n)\Rightarrow$ $T(n-1)+T(n-2)+n\Rightarrow$
$T_1(n)=2T(n-2)+n\rightarrow\Theta({\sqrt{2}}^n)$
$T_2(n)=2T(n-1)+n\rightarrow\Theta(2^n)$
**Con memoria**
1) $n=k$
2) Igual a sin memoria
3) $T(n)=T(n-1)+n\Rightarrow\Theta(T(n))=n^2$
# ==TEMA 4: Tipos recursivos==
Un ejemplo de tipo recursivo:
```java
interface Lista {
Integer getPrimero();
Lista getResto();
}
```
Un tipo recursivo es aquel que tiene una propiedad con valores del mismo tipo. Los tipos recursivos dan lugar a algoritmos recursivos específicos. Asumimos que cada tipo recursivo tiene un conjunto de subtipos disjuntos. El tipo puede definir un conjunto de predicados que indiquen de qué subtipo es.
```plantuml
hide methods
class Lista{}
class ListaPares {}
class ListaImpares {}
ListaPares -up-|> Lista
ListaImpares -up-|> Lista
```
### ♦ Árbol
Un árbol es un tipo de datos jerárquico, con una raíz y subárboles hijos.
- Un árbol n-ario (`Nary<E>`) puede ser vacío, puede tener un elemento (que llamaremos etiqueta), o puede ser un árbol n-ario que tiene n hijos. Si un árbol no tiene padre, se llama raíz.
- Si un árbol binario (`Binary<E>`):
- tiene etiqueta pero no tiene hijos, se llama hoja (`Leaf`).
- no tiene etiqueta ni hijos se llama vacío (`Empty`).
El tipo `Tree<E>` (árbol n-ario) y sus propiedades:
```java
sealed interface Tree<E> permits TEmpty<E>, TLeaf<E>, TNary<E> {
static Tree<String> parse(String s) { … }
static <R> Tree<R> empty() { … }
static <R> Tree<R> leaf(R label) { … }
static <R> Tree<R> nary(R label, List<Tree<R>> elements) { … }
int size();
int height();
Tree<E> copy();
Tree<E> reverse();
<R> Tree<R> map(Function<E, R> f);
String toString();
Stream<Tree<E>> byDepth();
Stream<TreeLevel<E>> byLevel();
}
```
El tipo `BinaryTree<E>` (árbol binario) y sus propiedades:
```java
sealed interface BinaryTree<E> permits BEmpty<E>, BLeaf<E>, BTree<E> {
static BinaryTree<String> parse(String s) { … }
static <R> BinaryTree<R> empty() { … }
static <R> BinaryTree<R> leaf(R label) { … }
static <R> BinaryTree<R> binary(R label,BinaryTree<E> left,
BinaryTree<E> right) { … }
int size();
int height();
Tree<E> copy();
<R> BinaryTree<R> map(Function<E, R> f);
String toString();
Stream<BinaryTree<E>> byDeph();
Stream<BinaryTreeLevel<E>> byLevel();
}
```
Si se quiere mapear los valores del árbol parseado desde un fichero se puede usar:
`BinaryTree.parse(s,Integer::valueOf)`
Se llama **tamaño** del árbol a su número de etiquetas (labels). Un árbol binario está **ordenado** si es vacío u hoja, o si la etiqueta es mayor que su hijo izquierdo y menor que su derecho. Un árbol binario es **equilibrado** si es vacío u hoja, o si sus hijos están equilibrados y sus alturas (camino más largo desde la raíz hasta una hoja) no difieren en más de una unidad.
Un **camino** es una secuencia de árboles en la que cada uno es padre del siguiente. Entre cada padre e hijo hay una **arista**. La **longitud de un camino** es el número de aristas. La **profundidad** de un árbol es la longitud de un camino desde la raíz hasta él.
Hay varias formas para recorrer árboles:
![[Pasted image 20231106183346.png|300]]
# ==TEMA 5: Grafos==
## 5.1. Conceptos y tipos (librería JGraphT)
Un grafo es un conjunto de vértices unidos por aristas. Los vértices y aristas son tipos que pueden tener información propia (tipos `V` y `E`). Las aristas y grafos pueden ser dirigidos y no dirigidos y los grafos también pueden ser mixtos.
- **Camino:** Secuencia de vértices en el que cada uno está conectado al siguiente mediante una arista.
- **Longitud de camino:** Número de aristas.
- **Camino simple:** No tiene vértices repetidos a excepción del primero que puede ser igual al último.
- **Camino cerrado:** El primer vértice consigue con el último.
- **Bucle:** Arista que une un vértice consigo mismo.
- **Grafos simples:** Desde `V1` hasta `V2` **sólo** hay una arista. No puede tener bucles.
- **Multigrafos:** Más de una arista entre dos vértices.
- **Pseudografos:** Más de una arista entre dos vértices y puede tener bucles.
- **Grafo completo:** Grafo simple en el que hay una arista entre cada par de vértices.
- **Subgrafo:** `G1` es subgrafo de `G2` si los vértices y aristas de `G1` están incluidos en los vértices y aristas de `G2`.
## 5.2. Formatos de ficheros para grafos
- `.gdf`: Representa información asociada a los vértices y aristas.
- `.dot/.gv`: Representa información que se necesita para visualizarlo.
## 5.3. Vistas de grafos
Elementos inmutables para "consultar" subconjuntos de datos de los grafos. Por ejemplo:
- **`SubGraphView<V,E>`**
- **`CompleteGraphView<V,E>`**
- **`IntegerVertexGraphView<V,E>`**
## 5.4. Recubrimientos, componentes conexas y ciclos
Un **grafo conexo** es un grafo no dirigido en el que hay al menos un camino entre cada dos nodos. Una **componente conexa** de un grafo no dirigido es un subgrafo conexo.
Si hablamos de grafos dirigidos, un grafo fuertemente conexo es un grafo donde para cada par de vértices $u,v$ existe un camino $u\rightarrow v$ y otro $v\rightarrow u$. Un grafo débilmente conexo es un grafo en el cual al reemplazar cada arista dirigida por una no dirigida resulta un grafo no dirigido conexo.
Un **ciclo** es un camino cerrado donde no se repiten vértices, salvo el primero que coincide con el último (ciclo de Hamilton). Un **grafo acíclico** no tiene ciclos. Un **árbol** es un grafo simple, conexo y acíclico. Un **bosque** es un conjunto de árboles (grafo sin ciclos).
El **recubrimiento mínimo** es un subgrafo (bosque) que incluye todos los vértices del grafo y minimiza la suma total de los pesos de las aristas escogidas.
El **recubrimiento de vértices** consiste en escoger el mínimo número de vértices que tocan todas las aristas del grafo.
## 5.5. Coloreado de grafos
Dado un grafo se define su **número cromático** como el mínimo número de colores necesario para dar un color a cada vértice de tal forma que dos vértices vecinos tengan colores distintos.
## 5.7. Camino mínimo
Dado un grafo y dos vértices encontrar el camino con longitud mínima entre ambos. Se resuelve o por Dijkstra ($\Theta(V^2)$) o por Floyd-Warshall ($\Theta(V^3)$).
### Ejercicio ejemplo
Dado un árbol n-ario de enteros, implementar un método recursivo que devuelva el camino de mayor longitud tal que:
1) No empiece en la raíz.
2) No termine ni en vacío ni en hoja.
3) Empiece y termine por un número par.
4) Contenga un número impar de números impares.

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

950
SEGUNDO/DSD/Teoría_2324.md Normal file
View File

@@ -0,0 +1,950 @@
# ==TEMA 1: Metodologías de diseño y herramientas==
## 1.1. Concepto de sistema digital
Un sistema electrónico procesa una información y la convierte en otra, siendo el soporte una variable eléctrica.
### ♦ Señales digitales y analógicas
![[image.png|450]]
Para convertir de físico (analógico) a digital se usa el sensor mientras que para lo contrario se usa el actuador.
## 1.2. Opciones de implementación
### ♦ Software VS Hardware
El software es fácil y barato pero el hardware tiene altas prestaciones.
Dentro del software se distinguen procesadores de propósito general y específico. Mientras que dentro del hardware se distinguen dispositivos programables y circuitos integrados.
El software, ya sea para propósito general (Java, C) o específico (Assembly), es más flexible en rapidez y diseño. Sin embargo, el hardware, ya sean programables (FPGA) o integrados, es mejor respecto al coste.
## 1.3. Realización del hardware
### ♦ Diferentes opciones para realizar un sistema
- **Off-the-shelf:** FPGAs, SPLD/CPLD, IC. Ya fabricados para comprar. El diseño termina con un bitstream o secuencia binaria. No se fabrican, se compran. Además, sirven para prototipar ASICs.
- **Manufactured:** Full-custom, ASIC. Fabricados a medida. Las ASICs tienen varias capas y termina con un layout (patrones geométricos para cada capa). Al fabricarse hay que testear tanto si sirve para el propósito para el que ha sido diseñado como si tiene defectos.
### ♦ Interior de un FPGA
![[fpga.png]]
- **CLB:** Bloques lógicos configurables para implementar la lógica.
- **I/O:** Interfaz de conexión para entrada/salida.
- **Red de interconexión:** Para conectar la entrada/salida de los CLB a la interfaz I/O.
Los CLBs se basan en LUTs (Look Up Tables), básicamente, memorias. Cada CLB contiene dos slices y cada slice contiene:
- 4 LUTs de 6 entradas.
- 8 flip flops configurables.
- Multiplexores.
- Lógica dedicada (para aritmética).
## 1.4. Diseño de hardware
> **HLSM:** High Level State Machine
### ♦ Flujo de diseño
![[flujo_diseño.png|400]]
<div style="page-break-before:always"></div>
# ==TEMA 2: Verilog==
Testbench en Verilog:
```verilog
`timescale 1ns/1ns
module comp_test
integer i,j; reg[1:0] a,b;
initial #1000 $finish;
initial begin
for(i=0; i<=3; i=i+1)
begin
for(j=0; j<=3; j=j+1)
begin
a=i; b=j; #10;
end
end
end
comp v_1(out1, out2, out3, a, b);
endmodule
```
## 2.1. Modelado estructural
- Componentes y como están conectados.
- Bloques simples o complejos.
- Instanciamos modules.
- Los modules tienen que estar descritos.
- Los "tipos" primitivos no se instancian (`and`, `or`, etc.).
- **TODO** es concurrente, no importa el orden.
- No se instancia dentro de `always` o `initial`.
### ♦ Tipos de datos:
- **Nets:** se usan en modelado estructural. El más común es `wire`.
- **Variable:** se usan en modelado comportamiento.
## 2.2. Modelado comportamiento
Son _procedures_ o flujos de actividad. Se ejecutan secuencialmente pero en la misma unidad de tiempo de simulación si no se especifica una. No se anidan. Los principales son `initial` (flujo que se ejecuta una vez) y `always` (cíclicamente).
### ♦ Tipos de datos:
- **Nets:** se usan en modelado estructural.
- **Variables:** se usan en _procedures_ (`initial`, `always`...). Conservan su valor hasta nueva asignación. El valor inicial es desconocido (x). El más común es `reg` (almacena un valor lógico). El tipo `reg` no sólo sirve para registros, además tiene el cualificador `signed`.
### ♦ Asignamientos bloqueantes y no bloqueantes:
- **Bloqueante (=):** se usan en _procedures_, no soporta _nets_ y se ejecutan antes de los que le siguen (una a una).
```verilog
initial
begin
a=1; b=0;
a=b; // usa b = 0
b=a; // usa a = 0
```
- **No bloqueante (<=):** se usan en _procedures_, no soportan _nets_ y **NO BLOQUEA** a los que vienen detrás (todo a la vez).
```verilog
initial
begin
a=1; b=0;
a<=b; // usa b = 0
b<=a; // usa a = 1
```
### ♦ Temporización:
- **Control de retrasos (#):** `#Δt sentencia;`
- **Control por eventos (@):** `@(evento/s) sentencia;`
- **Sentencia _wait_:** `wait (expresión) sentencia;` Espera hasta que `expresión == true` y se ejecuta.
### ♦ Control de flujo:
| Condicionales | Bucles | Otros |
|---|---|---|
| Ternario: `?...:...` | `repeat` | `disable` |
| Condicional: `if...else` | `for` | Paralelismo: `fork...join` |
| Casos: `case:` | `while` | |
| | `forever` | |
## 2.3. Síntesis de circuitos combinacionales
- _Netlist_ de primitivas o módulos combinacionales.
- Asignamientos continuos.
- _Procedures_ `always @ ()`.
- `Functions` y `tasks`.
### ♦ Ejercicios
<hr style="margin-top:10px;">
#### EJERCICIO 2. Realizar una puerta OR de tres entradas.
**a)** Usando primitivas del lenguaje.
```Verilog
module or3entradas(input a, b, c, output sal);
or c1(sal, a, b, c);
endmodule
```
**b)** Usando asignamientos continuos.
```Verilog
module or3entradas(input a, b, c, output sal);
assign sal = a || b || c;
endmodule
```
**c)** Usando un flujo de actividad cíclico y un bucle `for`.
```Verilog
module or3entradas(input a, b, c, output reg sal);
integer i;
wire[2:0] entrada;
assign entrada = {a,b,c};
always @ *
begin
sal = 0;
for(i = 0; i < 3; i = i + 1)
if(entrada[i] == 1)
sal = 1;
end
endmodule
```
**d)** Usando un `procedure` cíclico y un operador reducción.
```Verilog
module or3entradas(input a, b, c, output reg sal);
always @ *
sal = |{a,b,c};
endmodule
```
#### EJERCICIO 5. Realizar un codificador de 8 entradas (One-Hot) y 3 salidas.
```Verilog
module cod8(input [7:0] entrada, output reg [3:0] salida);
always @ *
case(entrada):
1: salida = 0; // en decimal
8'b00000010: salida = 3'b001; // en binario
4: salida = 2;
8: salida = 3;
16: salida = 4;
32: salida = 5;
64: salida = 6;
128: salida = 7;
default: salida = 3'bx; // desconocido
endcase
endmodule
```
## 2.4. Síntesis de circuitos secuenciales
Un latch se describe con un condicional incompleto:
```Verilog
always @ *
if(clock)
Q_latch = D;
```
Cuando se incluyen `posedge` o `negedge` en la lista de sensibilidad se sintetizan flip-flops:
```Verilog
always @ (posedge clk) Q_ff <= D;
```
Las señales de reset son importantes para los módulos secuenciales:
```Verilog
always @ (posedge clk or negedge reset) // asíncrono, activo en bajo
if(reset == 0)
Q <= 0;
else
Q <= D;
always @ (posedge clk) // síncrono, activo en alto
if(reset == 1)
Q <= 0;
else
Q <= D;
```
La lógica combinacional puede tener registros en sus salidas:
```Verilog
always @ (a or b)
y = a & b; // se sintetiza una puerta and
always @ (posedge clk)
y <= a & b; // se sintetiza una and conectada a un flip-flop D
```
### ♦ Ejercicios
<hr style="margin-top:10px;">
#### EJERCICIO 4. Realizar una descripción estructural del siguiente circuito.
![[Pasted image 20230922182358.png|600]]
```Verilog
// ---------------------
// BIESTABLE/FLIP-FLOP D
// ---------------------
module ff_D(input reset, clk, D, output reg Q);
always @ (posedge clk)
begin
if(reset == 1)
Q <= 0;
else if(set)
Q <= 1;
else
Q <= D;
end
endmodule
// ---------------------
// REGISTRO DE 8 BITS
// ---------------------
module reg8(input rst, set, clk, input [7:0] DATAIN, output [7:0] Q);
ff_D c1(rst, set, clk, DATAIN[0], Q[0]); // por posicion
ff_D c2(.reset(rst), .set(set), .clk(clk), .D(DATAIN[1]), .Q(Q[1])); // por nombre
ff_D c3(rst, set, clk, DATAIN[2], Q[2]);
ff_D c4(rst, set, clk, DATAIN[3], Q[3]);
ff_D c5(rst, set, clk, DATAIN[4], Q[4]);
ff_D c6(rst, set, clk, DATAIN[5], Q[5]);
ff_D c7(rst, set, clk, DATAIN[6], Q[6]);
ff_D c8(rst, set, clk, DATAIN[7], Q[7]);
endmodule
// ----------------------------
// CIRCUITO FIGURA EJERCICIO 4
// ----------------------------
module circP4(input rst, set, clk, input [7:0] DATAIN, output [7:0] q);
wire [7:0] R1;
wire [7:0] R2;
wire [7:0] R3;
reg8 c1(rst, set, clk, DATAIN, R1);
reg8 c2(rst, set, clk, R1, R2);
reg8 c3(rst, set, clk, R2, R3);
reg8 c4(rst, set, clk, R3, q);
endmodule
```
#### EJERCICIO 18. Realizar la descripción completa del EJERCICIO 4 en un único módulo.
```Verilog
module(input rst, set, clk, input [7:0] data_in, output [7:0] q);
reg [7:0] R1, R2, R3, R4;
always @ (posedge clk)
begin
if(rst == 1)
begin
R1 <= 0;
R2 <= 0;
R3 <= 0;
R4 <= 0;
end
else if(set == 1)
begin
R1 <= 8'b11111111; // binario
R2 <= 255; // decimal
R3 <= 8'b11111111;
R4 <= 8'b11111111;
end
else
begin
R1 <= DATAIN;
R2 <= R1;
R3 <= R2;
R4 <= R3;
end
end
assign q = R4;
endmodule
```
## 2.4. Síntesis de máquinas de estado finito (FSM)
### ♦ Ejercicios
<hr style="margin-top:10px;">
#### EJERCICIO 14. Realizar la descripción Verilog para la siguiente FSM.
![[Pasted image 20230922190331.png]]
```Verilog
// m = z porque z es HI
module FSMp14(input init, s, m, clk, output, t, p);
parameter ResetTimer = 2'b00, Wait = 2'b01, Pace = 2'b10;
reg [1:0] state;
always @ (posedge clk)
begin
if(init == 1)
state <= ResetTimer;
else
case(state)
ResetTimer: state <= Wait;
Wait:
if(s)
state <= ResetTimer;
else if(m)
state <= Pace;
else
state <= Wait;
Pace: state <= ResetTimer;
default: state <= ResetTimer;
endcase
end
assign t = (state == ResetTimer);
assign P = (state == Pace);
endmodule
```
#### EJERCICIO 10. Escriba una descripción usando Verilog de un registro de desplazamiento de 4 bits con operación de puesta a cero asíncrona y salida serie.
```Verilog
// SIN OPERADOR >>
module reg4bits(input reset, clk, DSerie, output OutSerie);
reg [3:0] Registro;
always @ (posedge clk, posedge reset)
begin
if(reset == 1)
Registro <= 0;
else
Registro <= {DSerie, Registro[3:1]};
end
assign OutSerie = Registro[0];
endmodule
// CON OPERADOR >>
module reg4bits(input reset, clk, DSerie, output OutSerie);
reg [3:0] Registro;
always @ (posedge clk, posedge reset)
begin
if(reset == 1)
Registro <= 0;
else
begin
Registro[2:0] <= Registro >> 1;
Registro[3] <= DSerie;
end
end
assign OutSerie = Registro[0];
endmodule
```
#### EJERCICIO 11. Escriba una descripción usando Verilog de un contador de 4 bits con las siguientes operaciones: reset asíncrono, carga en paralelo, inhibición, cuenta ascendente y descendente síncronas.
| Reset | Load | Cuenta | Sentido | Operación |
| --- | --- | --- | --- | --- |
| 1 | - | - | - | Puesta a cero |
| 0 | 1 | - | - | Carga en paralelo |
| 0 | 0 | 1 | 0 | Descontar |
| 0 | 0 | 1 | 1 | Contar |
| 0 | 0 | 0 | - | Inhibición |
```Verilog
module cont4bits(input clk, Reset, Load, Cuenta, Sentido, input [3:0] DATAIN, output reg [3:0] Contador);
endmodule
```
# ==TEMA 3: Comportamiento temporal de circuitos digitales==
## 3.1. Introducción
Una puerta lógica podemos entenderlo como un elemento compuesto por interruptores que conectan la salida al valor 1 o 0 en función de la entrada mediante transistores. Un modelo sencillo para explicar esto es el modelo RC:
![[Pasted image 20230929175157.png|400]]
- $R_p/R_n$ : Resistencia asociada al transistor $p/n$.
- $C_{INT}$ : Capacidad intrínseca asociada al dispositivo.
En el modelo RC: $retraso = {0.69RC}$ aproximadamente.
## 3.2. Puertas lógicas e interconexiones
### ♦ Parámetros temporales. Retrasos.
$$
Tiempos~de~trancisión=
\left
\lbrace
\begin{array}{c}
t_f:~Tiempo~de~bajada~(90\%-10\%) \\ t_r:~Tiempo~de~subida~(10\%-90\%)
\end{array}
\right.
$$
$$
Retrasos=
\left
\lbrace
\begin{array}{c}
t_{pLH}:~Tiempo~de~propagación~Bajo~Alto~(50\%-50\%) \\ t_{pHL}:~Tiempo~de~propagación~Alto~Bajo~(50\%-50\%)
\end{array}
\right.
$$
- Se pueden medir otros retrasos para una puerta: tiempo que transcurre hasta que la salida es válida o tiempo que transcurre hasta que la salida empieza a cambiar. Este último se denomina tiempo de contaminación.
- Los retrasos dependen a su vez del proceso de fabricación y de las condiciones de operación (temperatura, tensión).
- Los retrasos dependen de las condiciones de carga (qué se conecta a la salida de la puerta)
- Cada camino de entrada/salida tiene su propio retraso.
- Caracterizar el comportamiento temporal de las puertas es importante para poder analizar el comportamiento de los circuito.
- Los modelos de retrasos que se utilizan para dicho propósito tienen en cuenta dichos factores, y con frecuencia proporcionan tres valores para cada parámetro: mínimo, típico y máximo.
Hay dos tipos de retraso:
- **Retraso inercial:** medida del tiempo mínimo que un pulso de señal debe estar presente en la entrada de un dispositivo para que sus efectos aparezcan en la salida.
- **Retraso de trasnporte:** sólo implica un retraso de la propagación de la señal.
## 3.3. Circuitos combinacionales
- El **retraso** de un circuito combinacional depende de la transición de entradas aplicada. Dependiendo del cambio que se aplique en las entradas, éste se propaga por distintos caminos de señal.
- **Retraso de camino (path delay):** Tiempo que tarda la entrada en afectar a la salida cuando los cambios se propagan por dicho camino.
- **Camino crítico (critical path):** Camino de señal con mayor retraso.
- **Retraso máximo (circuit delay):** Retraso del camino crítico. Este es el que se usa como retraso de un circuito combinacional
Como consecuencias de los retrasos, en el circuito se producen pulsos cortos no deseados llamados glitches. Se dice que el sistema presenta azares cuando tiene riesgo de producir glitches. Hay distintas formas de impedir que ocurran:
- Aplicar métodos de diseño.
- Igualar los tiempos de retraso.
- Utilizar sincronizadores.
![[Pasted image 20230929182251.png|600]]
## 3.4. Circuitos secuenciales con reloj ideal
### ♦ Elementos de memoria
Los elementos de memoria son dispositivos básicos en los sistemas digitales. Estos tienen distintos parámetros:
| **Parámetro** | **Acrónimo** | **Descripción** |
| -------------------------- | ---------------- | ---------------- |
| Tiempo de establecimiento | $t_{setup}$ | Tiempo mínimo que deben mantenerse constantes las entradas antes del flanco |
| Tiempo de mantenimiento | $t_{hold}$ | Tiempo mínimo que deben mantenerse constantes las entradas después del flanco |
| Tiempos de propagación | $t_{pLH (CLK-Q)}$ $t_{pHL (CLK-Q)}$ | Tiempo desde el flanco hasta la respuesta |
| Frecuencia máxima de reloj | $f_{max}$ | Máxima frecuencia de reloj que admite el FF para ser fiable |
### ♦ Restricciones
![[Pasted image 20230929184616.png]]
- **Restricción de setup:** Entre dos flancos consecutivos de reloj, se debe permitir que Q1 se establezca a su valor correcto, que se propague a través de la lógica B y que llegue al FF2 con una antelación válida.
$T_{CLK} \geq t_{p,max}(FF1) + t_{p,max}(B) + t_{setup}(FF2)$
- **Restricción de hold:** Una vez que se produce el flanco de reloj, el retraso de propagación de FF1 y de la lógica B debe servir para que durante el tiempo de hold se mantenga en la entrada FF2 el dato anterior al flanco activo de la señal de reloj.
$t_{p,min}(FF1)+t_{p,min}(B) \geq t_{hold}(FF2)$
> **Reloj ideal:** Un reloj ideal es un reloj cuyo flanco activo llega simultáneamente a todos los elementos del circuito.
## 3.5. Circuitos secuenciales con reloj no ideal
Tienen dos incertidumbres características: el **jitter** y el **clock skew**. El clock skew es aleatorio y el jitter, sistemático.
- **Clock skew:**
- Los flancos activos del reloj no alcanzan a todos los elementos de memoria en el mismo instante.
- El skew está provocado por diferencias estáticas entre los distintos trayectos de propagación del reloj y por las diferencias en cuanto a carga de las distintas señales del reloj.
- Es constante entre un ciclo y otro.
- El skew no varía el período del reloj, sino sólo la fase.
Las restricciones son:
$T_{CLK} \geq t_{p,max}(FF1) + t_{p,max}(B) + t_{setup}(FF2) + t_{skew}$
$t_{p,min}(FF1)+t_{p,min}(B) \geq t_{hold}(FF2)+t_{skew}$
- **Jitter:**
- Variación aleatoria del instante de tiempo en el que llega el flanco activo del reloj a un punto determinado del circuito. (condiciones de entorno, de carga, etc. que hay en ese momento).
- Se trata de una medida de incertidumbre estrictamente temporal y que a menudo se especifica para un punto determinado del circuito: hace referencia al hecho de que el período de reloj puede reducirse o ampliarse de un ciclo a otro.
Las restricciones son:
$T_{CLK} \geq t_{p,max}(FF1) + t_{p,max}(B) + t_{setup}(FF2) + 2·t_{jitter}$
$t_{p,min}(FF1)+t_{p,min}(B) \geq t_{hold}(FF2)+2·t_{jitter}$
![[Pasted image 20230929190302.png|800]]
# ==TEMA 4: Técnicas de optimización a nivel RT==
## 4.1. Introducción
### ♦ Latencia y rendimiento
La latencia es el tiempo que tarda el sistema en producir un resultado. El rendimiento es el número de resultados producidos por unidad de tiempo.
## 4.3. Diseño de alto nivel
### ♦ Planificación de operaciones (Operator Scheduling):
Asociar operaciones a ciclos de reloj. Para la _Planificación 1_, forzosamente se necesitan dos multiplicadores ya que en el mismo ciclo no se pueden realizar dos operaciones de multiplicación concurrentemente. Sin embargo, para la _Planificación 2_, se puede utilizar un sólo multiplicador ya que las dos operaciones se realizan en ciclos de reloj distintos.
![[Pasted image 20231019203634.png]]
### ♦ Asignación de recursos (Operation Binding):
Se mapea un conjunto de operadores a un conjunto de componentes. Diferentes elecciones implican diferentes costes y retrasos. En la _Asociación 1_ se ha elegido esa posibilidad porque los datos no tienen nada en común. En la _Asociación 2_, se ha elegido esa posibilidad al aparecer $t_3$ tanto en A como en C.
![[Pasted image 20231019204020.png]]
### ♦ Ejemplo 1: Filtro FIR (Finite Impulse Response)
Este filtro convierte una secuencia de entradas digitales en otra secuencia de salidas digitales habiendo modificado la secuencia de entrada. Por ejemplo, la operación:
$y(t)=c_0·x(t)+c_1·x(t-1)+c_2·x(t-2)~\forall~c_0,~c_1,~c_2\equiv Constantes$
- **Planificación 1 (totalmente concurrente):** 2 estados. Uno de cómputo (FC), el datapath produce una salida cada ciclo. 3 Multiplicadores y 2 Sumadores.
![[Pasted image 20231019205129.png|600]]
- **Planificación 2 (serializada):** Una multiplicación por ciclo. 1 Multiplicador y 1 Acumulador. El datapath produce 1 resultado/5 ciclos.
![[Pasted image 20231019205143.png|550]]
## 4.4. Ejercicios:
<hr>
#### 2. El circuito de la Figura realiza un determinado procesado sobre 5 datos de entrada, generando un resultado en cada ciclo de reloj. Los bloques C1, C2 y C3 son circuitos combinacionales con retrasos de 1, 2 y 3 unidades de tiempo respectivamente. Suponga los registros ideales. La señal de reloj es común a todos los registros.
![[Pasted image 20231019194123.png]]
**a) Evalúe la latencia, el rendimiento y el periodo mínimo de la señal de reloj.
| $Latencia$ | $Rendimiento$ | $T_{min}$ |
| ------------------------ | ---------------------------------- | --------- |
| 1 ciclo = 5ut @$F_{MAX}$ | 1 resultado/ciclo = 1 resultado/5ut @$F_{MAX}$ | 5ut | | |
**b) Diseñe una versión con pipeline que produzca un resultado cada 4 unidades de tiempo. No se pueden modificar las componentes combinacionales. Minimice el número de registros de pipeline añadidos. Evalúe rendimiento, latencia y periodo mínimo para el diseño propuesto.**
| $Latencia$ | $Rendimiento$ | $T_{min}$ |
| -------------------------- | --------------------------------------------- | --------- |
| 2 ciclos = 24ut @$F_{MAX}$ | 1 resultado/ciclo = 1 resultado/4ut @$F_{MAX}$ | 4ut |
#### 3. El circuito de la figura realiza un determinado cálculo sobre las entradas A, B, C y D. Suponiendo los siguientes datos para el comportamiento temporal de sus componentes:
- **Flip-flops: retraso de propagación, $T_{p_{clk}}$->Q = 0.5ns, $T_{hold}$=0.1ns, $T_{setup}$=0.3ns**
- **Retraso de propagación máximo de 20 ns para el multiplicador y de 5 ns para el sumador**
- **Retrasos asociados a las salidas y a las entradas nulos**
![[Pasted image 20231019200308.png]]
**a) Calcule el periodo mínimo de la señal de reloj. El reloj, aunque no se muestra, es común para todos los registros e ideal.**
$T_{min}=25ns+0,5ns+0,3ns=25,8ns$
**b) Determine el rendimiento y la latencia en términos de ciclos de reloj.**
$Latencia = 2~ciclos = 51,6ns~@F_{MAX}$
$Rendimiento = 1~resultado/ciclo = 1~resultado/25,8ns~@F_{MAX}$
**c) Modifique el circuito para mejorar el rendimiento. Evalúe el rendimiento del circuito modificado suponiendo que se opera a la frecuencia máxima posible.**
*$Latencia = 3~ciclos = 62,4ns~@F_{MAX}$
$Rendimiento = 1~resultado/ciclo = 1~resultado/20,8ns~@F_{MAX}$
$T_{min}=20ns+0,5ns+0,3ns=20,8ns$
#### 4. Sea el circuito de la figura con los retrasos de propagación máximos y mínimos de cada bloque combinacional que se muestran en la siguiente tabla.
![[Pasted image 20231019201431.png]]
**a) ¿Qué registro o registros de pipeline (R1, R2, R3) eliminaría para minimizar la latencia (en tiempo) suponiendo operación a la frecuencia máxima? Explique su respuesta.**
| $Latencia Original$ | $Latencia$ | $Latencia~sin~R1$ | $Latencia~sin~R2$ | $Latencia~sin~R3$ |
| --------------------- | ------------ | ----------------- | ----------------- | ----------------- |
| 4 ciclos · 7ns = 28ns | 3 etapas · 7ns = 21ns | 3 etapas · 13ns = 39ns | 3 etapas · 12ns = 36ns | 3 etapas · 8ns = 24ns |
**b) ¿Qué registro o registros eliminaría para maximizar el rendimiento suponiendo operación a la frecuencia máxima? Explique su respuesta.**
Ninguno ya que el rendimiento ya es máximo con un $T_{min}$ de 7 nanosegundos.
#### 5. Diseña un sistema que calcule $X^2·Y^2+Z^2+W^2$ utilizando el algoritmo mostrado en la Figura P5 y con las siguientes consideraciones:
- **No entrar en el detalle de número de bits**
- **Los datos están disponibles mientras se realiza el cálculo y no se almacenan en registros**
- **Los recursos de cálculo (unidades funcionales) disponibles son: multiplicadores (M), sumadores (S) y elevadores al cuadrado (C)**
- **F1 = X^2
- **F2 = Y^2**
- **F3 = F1 · F2**
- **F4 = Z^2**
- **F5 = F3 + F4**
- **F6 = W^2**
- **F7 = F5 + F6**
**a) Sol 1: Todo el cálculo en un ciclo de reloj**
<table style="border: 1px solid;">
<tr>
<td>1</td>
<td>F1</td>
<td>F2</td>
<td>F3</td>
<td>F4</td>
<td>F5</td>
<td>F6</td>
<td>F7</td>
</tr>
</table>
- 4 Cuadrados
- 1 Multiplicación
- 2 Sumas
**b) Sol 2: Todo el cálculo en dos ciclos de reloj**
<table style="border: 1px solid;">
<tr>
<td>1</td>
<td>F1</td>
<td>F2</td>
<td>F3</td>
</tr>
<tr>
<td>2</td>
<td>F4</td>
<td>F5</td>
<td>F6</td>
<td>F7</td>
</tr>
</table>
- 2 Cuadrados
- 1 Multiplicación
- 2 Sumas
**c) Sol 3: sólo se usa una unidad de cálculo de cada tipo (1C, 1M, 1S)**
<table style="border: 1px solid;">
<tr>
<td>1</td>
<td>F1</td>
</tr>
<tr>
<td>2</td>
<td>F2</td>
<td>F3</td>
</tr>
<tr>
<td>3</td>
<td>F4</td>
<td>F5</td>
</tr>
<tr>
<td>4</td>
<td>F6</td>
<td>F7</td>
</tr>
</table>
**d) Sol 3 Alternativa: sólo se usa una unidad de cálculo de cada tipo (1C, 1M, 1S) y SIN ENCADENAMIENTO DE OPERACIONES**
<table style="border: 1px solid;">
<tr>
<td>1</td>
<td>F1</td>
</tr>
<tr>
<td>2</td>
<td>F2</td>
</tr>
<tr>
<td>3</td>
<td>F3</td>
<td>F4</td>
</tr>
<tr>
<td>4</td>
<td>F5</td>
<td>F6</td>
</tr>
<tr>
<td>5</td>
<td>F7</td>
</tr>
</table>
# ==TEMA 5: Aritmética en punto fijo==
## 5.1. Sistemas de numeración
El objetivo principal es implementar en el hardware funciones aritméticas, atendiendo a: velocidad, coste, simplicidad... Estos circuitos forman la base del procesado de datos.
- Un número binario de longitud $n$ es una secuencia ordenada $(x_{n-1}x_{n-2}...x_1x_0)$ de dígitos binarios donde cada dígito $x_i$ toma valores 0 o 1.
- Esta longitud $n$ es importante ya que los números binarios se almacenan en registros de longitud fija.
- La base es llamada _radix_.
- El rango de números representables será $[X_{min},~X_{max}]$. Si no cabe en el rango, hay _overflow_.
- El sistema binario es un ejemplo específico de un sistema de numeración. Un sistema de numeración se define por el conjunto de valores y la regla que define el mapeo entre los dígitos y sus valores. Hay dos tipos, convencionales (binario, decimal,...) y no convencionales (bases negativas, dígitos con signo,...).
### ♦ Propiedades de los sistemas de numeración convencionales
- **No redundante:** Cada número tiene representación única, es decir, no hay dos secuencias con el mismo valor.
- **Pesado:** Una secuencia de pesos $(w_{n-1}w_{n-2}...w_1w_0)$ determina el valor de la secuencia $(x_{n-1}x_{n-2}...x_1x_0)$ como: $\sum_{i=0}^{n-1}{x_i·w_i}$ .
- **Posicional:** El peso $w_i$ depende sólo de la posición $i$ del dígito $x_i$ . Se cumple $w_i = r^i$ .
- $r$ es la base del sistema de numeración.
- Si no hay redundancia, $0\leq x_i\leq r-1$ .
### ♦ Conversión entre bases
Pretendemos convertir un número en base $r$ a base $R\neq r$ . Se usan los métodos de divisiones sucesivas para la parte entera y multiplicaciones sucesivas para la parte fraccionaria.
![[Pasted image 20231020180724.png|500]]
### ♦ Números negativos
Hay dos formas para representarlos:
- **Signo-Magnitud:**
- El signo y la magnitud se representan de forma separada
$x_Sx_{n-2}x_{n-3}~...~x_2x_1x_0$
donde $x_S$ es el dígito de signo y $x_{n-2}x_{n-3}~...~x_2x_1x_0$ la magnitud (n-1 bits).
- En binario, el rango es $[-(2^{n-1}-1),+(2^{n-1}-1)]$ .
- **Complemento a dos:**
- Los números positivos se representan igual que en S-M.
- Un número negativo $(-Y)$ se representa por $(R-Y)$, donde $R$ es una constante.
- Esta representación satisface $-(-Y)=Y$ ya que $R-(R-Y)=Y$ .
- No se repite el 0.
- En binario, el rango es $[-2^{n-1},+(2^{n-1}-1)]$.
- Las ventajas de esta representación son:
- $X-Y=X+(-Y)=X+(R-Y)$
- No hay necesidad de decidir antes de sumar o restar ni de cambiar el orden de los operandos.
- Ejemplo Ca2
$r=2,~k=n=4\rightarrow m = 0, ulp=2^0=1$
$~~~5=0101$
$-5=1010+1=1011$
## 5.2. Circuitos básicos para aritmética binaria
### ♦ Half Adder
![[Pasted image 20231020190719.png|500]]
### ♦ Full Adder
![[Pasted image 20231020185900.png|500]]
![[Pasted image 20231020185919.png|500]]
### ♦ Restador
![[Pasted image 20231020185944.png|500]]
## 5.3. Arquitecturas de sumadores
### ♦ Ripple Adder
![[Pasted image 20231020190026.png|400]]
Se necesita esperar que atraviese los $n$ FAs antes de que la suma sea válida. Tiene un retraso con crecimiento lineal. El esquema más común para mejorar la velocidad es el Carry Look-Ahead.
### ♦ Carry Look-Ahead (Acarreo Adelantado)
Se generan todos los acarreos en paralelo y ello es posible ya que dependen de las entradas y todas están disponibles simultáneamente. Utiliza las funciones de generación $g_i$ y propagación de acarreo $p_i=a_i+b_i$.
![[Pasted image 20231020190852.png|550]]
Se mejora el retraso pero se empeora la complejidad con un acarreo serie cada 4 sumadores.
![[Pasted image 20231020191227.png|600]]
La idea del CLA es generalizar de nivel de bit a nivel de grupos de bits:
![[Pasted image 20231020191649.png|600]]
### ♦ Sumador de Brent-Kung
Sea una función $F$:
![[Pasted image 20231020192219.png|500]]
Para solucionar el incremento lineal del retraso, se puede usar un árbol binario:
![[Pasted image 20231020192311.png|300]]
Quedando el árbol completo como:
![[Pasted image 20231027174952.png|500]]
- El área es casi el doble de un Ripple.
- El layout es muy compacto.
- Los bits de suma requieren un tiempo adicional constante.
### ♦ Sumadores por suma condicional
- Tienen retraso logarítmico.
- Hay dos grupos de salidas. En un grupo se realiza la suma con carry 1 y en el otro con carry 0.
- Una vez que se conoce el carry, solo se necesita un MUX para elegir la suma correcta, librándonos de la propagación.
![[Pasted image 20231027175641.png|300]]
# ==TEMA 6: Multiplicación, división y gen. de func.==
## 6.1. Multiplicación
### ♦ Combinacional
La multiplicación combinacional es costosa, compleja y permite menos modularidad pero es más rápida.
### ♦ Secuencial
Sean dos números positivos $X=01011_{(2}$ y $A=01101_{(2}$ para realizar $A\times X$ :
![[Pasted image 20231027182505.png|400]]
Puede pasar que el multiplicando esté en Ca2 y por tanto tenga 1 bit en el más significativo si es negativo: $x_{n-1}=1\rightarrow X=-x_{n-1}2^{n-1}+\tilde{X}$ con $\tilde{X}=\sum_{j=0}^{n-2}{x_j2^j}$ . Ignorando el bit de signo el resultado sería $\tilde{X}·A$. Como buscamos $X·A$, se deberá restar $A$ en Ca2.
### ♦ Multiplicadores de altas prestaciones
- **Carry-Save Adder:** El CSA acepta X operandos de n-bits y genera Y resultados de n-bits. Siendo Y el numero de bits necesarios para representar X.
- **Reducir los productos parciales:** Al examinar simultáneamente dos o más bits del multiplicador, entonces se reducen los productos parciales. Un algoritmo que usa esto es el Algoritmo de Booth. Por ejemplo: $7A=(2^3-2^0)A=2^3A-2^0A=2^3A+Ca2(A)$
- **Usando multiplicadores más pequeños:** Si un multiplicador de $n\times n$ bits se construye como un CI, podemos usarlo para hacer multiplicadores más complejos. Un multiplicador de $2n\times 2n$ se puede construir con 4 multiplicadores $n\times n$ ya que:
$A·X=(A_H·2^n+A_L)·(X_H·2^n+X_L)=A_HX_H2^{2n}+(A_HX_L+A_LX_H)2^n+A_LX_L$
donde $H$ o $L$ son las mitades más y menos significativas.
- **Multiplicación paralela:**
![[Pasted image 20231103173621.png|550]]
## 6.2. División
### ♦ Operación y técnicas básicas
La división es la operación mas compleja y que más consume de las cuatro operaciones.
En general, dado un dividendo $X$ y un divisor $D$, se genera un cociente $Q$ y un resto $R$ tal que
$X=Q·D+R$ (con $R < D$), suponiendo $X, D, Q$ y $R$ positivos. $X$ puede ocupar un registro doble ($2k$) mientras que los otros ocupan un registro simple ($k$). $Q$ debe ser menor que el número máximo que admita un registro simple: $Q<2^k$ y $R<D$ . Se debería chequear $D\neq 0$ para la división entre 0.
**Ejemplo de división 32/6:**
![[Pasted image 20231103175734.png]]
La división entera puede reformularse como división fraccionaria y viceversa. Sólo que el resto debe desplazarse a la derecha $k$ bits.
### ♦ División con restauración
![[Pasted image 20231103180346.png]]
Para operandos con signo, se usa la expresión $X=Q·D+R$ junto con $sign(R)=sign(X)$ y
$|R|<|D|$ .
### ♦ División sin restauración
En esta división almacenamos $q_{k-j}=1$ en el $PR$ , conduciendo a un resto parcial temporalmente incorrecto. Esto es aceptable porque...
- Al inicio $[PR]=u$ .
- Si hemos restaurado el resto parcial $(u-2^kD)$ a su valor correcto $u$, deberíamos continuar con el desplazamiento de $u$ a $2u$ y la nueva resta $2u-2^kD$ .
## 6.3. Generadores de función
Una LUT de $n$ bits puede codificar cualquier función booleana modelando dicha función en su tabla de verdad. LUTs con 4-6 bits de entrada son componentes clave en las FPGAs.
![[Pasted image 20231103180901.png]]
Se usa el algoritmo CORDIC (COordinate Rotation DIgital Computer), conocido como método de dígito por dígito. Se basa en la observación de que si se rota un ángulo $\alpha$ de un vector de longitud unidad cuyo extremo se encuentra inicialmente en $(x,y)=(1,0)$, el nuevo extremo se encuentra en $(X,y)=(\cos\alpha,\sin\alpha)$, por lo que $\cos\alpha$ y $\sin\alpha$ podrían calcularse obteniendo las coordenadas del nuevo extremo después de rotar $\alpha$.
# ==TEMA 8: Optimización del consumo de potencia==
## 8.1. Medida de la potencia disipada
### ♦ Baterías
Al reducir la potencia, se pueden usar fuentes de energía alternativas, o incluso hacer móviles aplicaciones que no lo eran tradicionalmente.
### ♦ Temperatura
El aumento de temperatura puede provocar daños al sistema como acortar la vida útil o la necesidad de utilizar disipadores, por lo que es bueno reducir el consumo de potencia.
### ♦ Potencia instantánea y potencia promedio
- **Potencia instantánea:**
$P(t)=\sum_i{V_i(t)·I_i(t)}$
- **Potencia promedio:**
![[Pasted image 20231117175704.png|150]]
### ♦ Potencia en un inversor CMOS
Se puede calcular la potencia disipada de un sistema digital sumando la potencia de sus elementos (los más básicos: puertas). A partir de la puerta más sencilla, el inversor, se estudian las demás puertas más complejas.
![[Pasted image 20231117181013.png|500]]
En la segunda situación es cuando se consume la mayor cantidad de potencia.
$P=\frac{1}{2}·f·C_L·\alpha·V_{dd}^2$
- $f$ = frecuencia
- $C_L$ = capacidad de carga
- $\alpha$ = actividad de conmutación: número de veces que las puertas conmutan
Extendiendo a sistemas completos:
$\overline{P_{Sistema}}=N·f_{clk}·\overline{C}·\overline\eta·V_{DD}^2$
## 8.2. Nivel de tecnología
- Elegir la tecnología adecuada (menos capacidad en los nudos y menor tensión de alimentación).
- Aumentar tensiones umbrales (reduce la potencia estática y de corto y no afecta a la de conmutación $\rightarrow$ reduce la velocidad).
- Usar una tensión de alimentación más baja que la permitida (reduce la potencia estática y de corto y no afecta a la de conmutación $\rightarrow$ reduce la velocidad).
## 8.3. Nivel de circuito
- Reducción de la potencia de conmutación.
- Reducción de la potencia por corriente de corto.
- Reducción de la potencia estática.
## 8.4. Nivel lógico
### ♦ Codificación
Sea un diagrama de estados:
| ![[Pasted image 20231117182510.png]] | ![[Pasted image 20231117182752.png]] | ![[Pasted image 20231117182759.png]]v |
| --- | --- | --- |
| Original | Contando trancisiones | Codificada |
Hay dos estados con un alto número de transiciones que tienen códigos con distancia un bit. En algunos casos la parte combinacional es más compleja.
### ♦ Detener el reloj
![[Pasted image 20231117182859.png|300]]
La función de activación Fa detecta cuando la FSM está internamente inactiva (no hay transiciones) y detiene el reloj. Para detener el reloj se suele usar un circuito como este:
![[Pasted image 20231117183043.png|250]]
### ♦ Particionado de FSM
Se divide la FSM en dos FSMs más sencillas.
![[Pasted image 20231117183211.png|300]]
### ♦ Pre-cálculo
Las salidas se calculan en el ciclo anterior para reducir la conmutación. Si una salida se puede
pre-calcular, se puede "inhabilitar" el circuito lógico. Hay algunos casos en los que es peor por ejemplo:
![[Pasted image 20231117183427.png|300]]
![[Pasted image 20231117183436.png|400]]
- Se incrementa el área
- El retraso entre R1 y R2 aumenta
- El retraso anterior a R1 se incrementa
### ♦ Balancear caminos
![[Pasted image 20231117183901.png|450]]
### ♦ Retiming
Se localizan los nodos con una alta actividad de azar y alta capacidad de carga. En esos nodos se colocan flip-flops. Hay que asegurarse que el tiempo de ciclo del circuito no incremente y de especificar un límite superior en el número de registros.
## 8.5. Nivel RT
### ♦ Aislar operandos
![[Pasted image 20231117184539.png|500]]
### ♦ Re-especificación del control
La actividad de las unidades desocupadas se puede eliminar escogiendo los valores de control de la lógica de conexión (multiplexores y drivers tri-estado). Los valores de control de la lógica de conexión suelen ser _dont care_ en la FSM cuando la unidad no se utiliza.
### ♦ Segmentación de la memoria
Una memoria está desocupada cuando almacena un dato irrelevante. Los recursos de memoria se dividen en segmentos (clusters). Cuando un segmento está desocupado se pone en _sleep mode_, es decir se deshabilita el reloj o la señal de refresco.
## 8.6. Nivel arquitectural
Cuando la arquitectura del sistema se basa en un CPU, la carga capacitiva de E/S es mayor que la de los nudos internos del CPU. El consumo de las memorias aumentan con el tamaño.
### ♦ **Técnicas de codificación de bus**
La potencia disipada depende de la distancia Hamming entre datos sucesivos.
- La codificación One-hot es la peor al tener buses mayores
- La codificación binaria da el peor pico de actividad
- El código Gray es el mejor y reduce la actividad un 50%
![[Pasted image 20231117185847.png|400]]
- **Bus-Invert:** Se aplica a los buses y requiere una señal adicional invert.
![[Pasted image 20231117190242.png|400]]
La actividad de conmutación de pico se reduce un 50%. Para buses de datos sin datos correlacionados, se reduce la conmutación promedio hasta un 20%, pero aumenta con el tamaño del bus. Requiere lógica adicional en los extremos del bus.
- **T0:** para codificar buses de direcciones. Requiere una señal INC extra.
![[Pasted image 20231117190612.png|200]]
Si $INC=1$ y las direcciones son consecutivas, no se modifica el bus y el receptor calcula la dirección incrementando la anterior. En caso contrario $INC=0$ y se transmite el nuevo dato en el bus.
- **Beach Solution:** se aplica en buses de direcciones. Las líneas del bus se agrupan en _clusters_ cuyas líneas están altamente correlacionadas y para cada _cluster_ se genera una función de codificación adecuada.
### ♦ Optimización de memoria
Es importante minimizar el número de accesos a la memoria externa y su tamaño:
- Incrementando la densidad de código
- Reduciendo la frecuencia de operaciones E/S
- Mejorando las características de la caché
## 8.7. Nivel de software
### ♦ Apagar el sistema
- **No predictivo:** se apaga después de un intervalo fijo.
- **Predictivo:** se apaga basándose en un historial de actividad.
# ==TEMA 9: Entrefases digitales==
**⚠️ Definición:** Pad/s = Pin/es
## 9.1. El encapsulado
Hay varios requerimientos para un encapsulado:
- **Eléctricos:** Capacitancia, resistencia, inductancia...
- **Interfaz:** Número de pines I/O.
- **Mecánicos:** Protección Die/Bond, compatibilidad con el PCB...
- **Térmicos:** Disipar el calor.
- **Coste:** El mínimo posible.
Hay dos tipos de encapsulado:
- **Wire bonding:** Los pads están alrededor de los bordes del chip. Es un proceso lento pero más barato. Al ser los cables más largos puede que haya capacitancias o inductancias parasitarias.
- **Flip chip:** Los pads están encima del núcleo del CI. Hay muchos pines y es un proceso rápido pero caro. No presenta mucha capacitancia o inductancia parasitaria.
El wire bonding tiene algunos requisitos:
- No cruzar cables.
- Aprovechar el mínimo espacio
- Los cables deben estar en el máximo ángulo y longitud.
El encapsulado puede estar a través de agujeros o en la superficie soldado:
![[Pasted image 20231124180740.png|400]]
Los encapsulados tienen varios efectos:
- **Parástios eléctricos:** Inducciones mutuas, acoplos capacitivos (o capacidades parasitarias), límites de corriente...
- **Alimentaciones:** Dominios, señales I/O.
- **Efectos térmicos:** Resistencias térmicas de las cápsulas, disipación externa...
## 9.2. Niveles de tensión
$V_{IH}$= Tensión de entrada en alto
$V_{IL}$= Tensión de entrada en bajo
$V_{OH}$= Tensión de salida en alto
$V_{OL}$= Tensión de salida en bajo
Si queremos que dos tecnologías sean compatibles sus niveles de tensión y será necesaria una circuitería de _glue logic_ o de desplazamiento de nivel.
## 9.3. Tipos de pines I/O
Para que dos sistemas digitales se comuniquen deben ser compatibles (niveles de tensión, tipo de pines, etc). Hay varios tipos de pines:
- **Digital:**
- Entradas (I): Datos, test, configuración...
- Salidas (O): Capacidad de driving, niveles...
- Salidas tri-estado: Pueden ponerse en alto (H), bajo (L) o alta impedancia (HI).
- Bidireccionales (I/O): Entrada (I) y salida tri-estado.
- Relojes (CLK): Entradas específicas para reloj.
- **Analógico:**
- **Alimentación:** Alimentación ($V_{CC}$) y tierra ($GND$).
### ♦ Circuitos de protección
![[Pasted image 20231124183518.png|500]]
### ♦ Estructura de un pad de entrada
El buffer de entrada aísla el interior de las tensiones de la placa (5V y 3,3V). Después la señal se convierte en valores de tensión usados por la circuitería interna (1,2V).
![[Pasted image 20231124183648.png|500]]
### ♦ Estructura de un pad de salida
![[Pasted image 20231124183832.png|400]]
## 9.3. Problemas/Precauciones
### ♦ Efectos de la carga capacitiva
El tiempo de propagación de cualquier buffer digital depende de la carga capacitiva:
$t_p=t_{pi}+\alpha C_L$
Las cargas capacitivas de de los nudos externos son particularmente más altas que los internos.
### ♦ Entradas flotantes
Entradas que tienen un uso esporádico o innecesario en ciertas aplicaciones. Cuando un pin de entrada es atacado por uno o varios buffers tri-estado, es posible que el nudo quede en HI durante mucho tiempo.
### ♦ Rebotes de la tierra/alimentación
Los CMOS se caracterizan por producir picos en alimentación y tierra. Son intensos en los buffers potentes (salidas del CI) o si varios conmutan síncronamente (buses). Es una causa habitual de mal funcionamiento.
### ♦ Conmutación simultánea de salidas
Deben tomarse ciertas precauciones. Los picos producirán _ground/power bounce_. La corriente disponible en los buffers de salida se ve limitada lo que puede aumentar los tiempos de propagación en función del número de salidas que conmutan a la vez.
### ♦ Entradas de pendiente baja
Durante un cierto tiempo los niveles lógicos de las señales estarán indeterminados, produciendo un alto nivel de corriente (corriente de corto circuito) entre alimentación y tierra. Se pueden producir rebotes y pérdida de integridad de las señales de entrada.
### ♦ Conflictos en buses
Pueden haber conflictos al escribir dos datos a la vez en un bus, lo que provoca un "cortocircuito" en el bus.
### ♦ Transitorios de encendido
Idealmente se debe realizar el encendido (_power-up_) debe hacerse lentamente. Un encendido mal realizado puede llevar a un mal funcionamiento temporal o daño permanente.
### ♦ Propagación de señales
Una pista de interconexión es "corta" o "larga" en función de si el tiempo invertido por la señal en recorrerla es comparable o no al tiempo de retardo.
$v=\frac{d}{t}$
$c=f·\lambda~~~Si~ ~L=\lambda_{min}=\frac{c}{f_{máx}}\rightarrow Línea~de~transmisi\acute{o}n$
## 9.4. Entrefases digitales
- Las FPGAs modernas tienen innumerables capacidades de configuración y programación de sus pines de entrada/salida.
- En general pueden configurarse para soportar un número muy elevado de estándares diferentes, incluyendo los totalmente diferenciales.
- Cada pin puede configurarse como entrada, salida/tri-state, o bidireccional.
- Puede configurarse y programarse el tipo de terminación resistiva.
- Pueden configurarse las salidas como tipo open-drain.
- Las entradas pueden configurarse para tener circuitos de bus-hold.
- Las entradas pueden configurarse para tener resistencias de pull-up/down .
- Las entradas pueden tolerar señales de estándares de tensión más alta.
- Las señales de I/O pueden ser asíncronas o síncronas.
<h1 style="background-color:salmon;">TEMA 10: RISC-V (No entra al final)</h1>
## 10.1. Introducción
El origen de RISC se dio al compilar un sistema UNIX en un procesador Motorola 68000, al ver que sólo se usaban un 30% de las instrucciones.
### ♦ Procesadores anteriores a RISC-V
- **RISC-I (1981):** Llamado Gold. Tenía 44500 transistores que implementaban 31 instrucciones. Disponía de 78 registros internos de 32 bits.
- **RISC-II (1983):** Llamado Blue. Tenía 39000 transistores. Disponía de 138 registros de 32 bits.
- **SOAR (1984):** RISC convertido para ejecutar Smalltalk. Tenía 35700 transistores NMOS de 4 micras. Consumía 3W y funcionaba a 2,5MHz.
- **SPUR (1988):** Permite multiprocesador. Tenía 115214 transistores. Fabricado en CMOS de 1.6 micras y opera a 10MHz.
- **DLX (1990):** Es MIPS peor simplificado y con propósito educativo. Basado en DLX de OpenRISC. RISC-V se basa en este.
## 10.2. Características
El juego de instrucciones es **reducido**, más que otros ISAs. Hay una clara separación entre el ISA de usuario y el privilegiado. Evita microarquitectura y características dependientes de varias tecnologías. Su ISA es modular y estable.
Hay 4 versiones básicas de las ISAs: rv32E, rv32I, rv64I, rv128I.
A cada versión se le puede añadir varias extensiones:
- **Integer (I):** Básica. Dispone de 32 registros de propósito general.
- **Embedded (E):** Corresponde a la versión I con 16 registros de propósito general.
- **Multiplication (M):** Extensión con operaciones de multiplicación y división.
- **Atómica (A):** Extensión con instrucciones atómicas.
- **Floating point (F):** Punto flotante.
- **Double (D):** Punto flotante con precisión doble.
- **General Purpose (G):** Propósito general.
![[Pasted image 20231201181656.png]]
La longitud de de instrucción es de 32 bits. Se puede tener un conjunto más amplio de la longitud para soportar diferentes extensiones.
La arquitectura interna sigue el siguiente esquema:
- 32 registros de propósito general de N bits (N = 32, 64, 128)
- La versión rvNE dispone de 16 registros de N bits
- El registro x0 no puede escribirse y almacena el valor 0
- La ALU realiza operaciones de números con signo
- Los registros de estado CSR ocupan el espacio de direcciones de 4KB
(0x0000-0x0FFF).
Los nombres de los registros siguen el siguiente convenio:
![[Pasted image 20231201182255.png]]
El bus de direcciones es de 32/64 bits (el de 128 está en desarrollo). Los periféricos están mapeados en memoria. Datos de 8 bits (byte), 16 bits (half-word) y 32 bits (word). El almacenamiento está en Little Endian y alineado en memoria.
## 10.3. ISA (Instruction Set Architecture)
Hay 6 tipos de instrucciones:
![[Pasted image 20231201183414.png]]
- Los campos `opcode`, `funct3` y `funct7` contienen el código de instrucción.
- El campo `rd` es el registro destino, `rs1` y `rs2` son registros fuentes.
- Los campos `imm` son o un dato o una dirección de memoria.
Al añadir instrucciones se añaden:
- 14 para instrucciones privilegiadas.
- 8 para versión M
- 11 para A
- 34 para FDQ
- 46 para C
- 12 para las variaciones 64I/128I
Hay varios niveles:
- **Máquina (M):** Máxima prioridad. Obligatorio.
- **Modo usuario (U) y supervisor (S):** Aplicaciones convencionales y con S.O.
- **Modo hipervisor (H):** Monitorización de máquinas virtuales.
Hay 224 registros que ocupan 4KB:
- U: 77
- S: 11
- H: 11
- M: 125
La mayoría son contadores:
- U: 66
- M: 97

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Some files were not shown because too many files have changed in this diff Show More