TeX erweitert

This commit is contained in:
2023-06-17 11:57:10 +02:00
parent f8021331d2
commit b08f8d112a
6 changed files with 153 additions and 16 deletions

66
TeX/TestCrossing.tex Normal file
View File

@@ -0,0 +1,66 @@
\documentclass[border=0.2cm]{standalone}
% Required packages and libraries
\usepackage{circuitikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
% Circuit style
% Logic ports
\node[or port] (ORa) at (0,0){ORa}; %In1
\node[not port] (Noa) at (0,-2){Noa};
\node[or port] (ORb) at (0,-4){ORb};
\node[not port] (Nob) at (2.5,0){Nob};
\node[and port] (ANDa) at (2.5,-3){ANDa};
\node[or port] (ORc) at (5,-1.5){ORc};
% Connection
\draw (ORa.out) -- (Nob.in);
\draw (Noa.out) -| (ANDa.in 1);
\draw (ORb.out) -| (ANDa.in 2);
\draw (ANDa.out) -| (ORc.in 2);
\draw (Nob.out) -| (ORc.in 1);
\draw (ORc.out) -- ++(1,0) node[near end,above]{Out};
\draw (ORa.in 1) -- ++(-1.5,0)node[left](In1){In1};
%\draw (ORb.in 2) -- ++(-1.5,0)node[left](In3){In3};
% Jump crossing element
\node at (ORa.in 2)
[
below,
jump crossing,
rotate=-90,
scale=1.3
](X){\tiny{X}};
\draw (Noa.in) -| (X.east)
(X.west) to[short,-*] (X.west |- ORa.in 1);
%\draw ($ (In1) !.5! (In3) $) node[]{In2}
% ++ (0.4,0) to[short,-*] ++(0.5,0) coordinate(a)
% |- (X.south) (a) |- (ORb.in 1);
\end{tikzpicture}
\end{document}
\documentclass{article}
\title{Untitled}
\author{}
\date{2023-6-14}
\begin{document}
\maketitle
\end{document}

View File

@@ -54,6 +54,30 @@
major step/.initial=1, major step/.initial=1,
major line width/.initial=1pt, major line width/.initial=1pt,
} }
\tikzset{
declare function={% in case of CVS which switches the arguments of atan2
atan3(\a,\b)=ifthenelse(atan2(0,1)==90, atan2(\a,\b), atan2(\b,\a));
},
kinky cross radius/.initial=+.125cm,
@kinky cross/.initial=+,
kinky crosses/.is choice,
kinky crosses/left/.style={@kinky cross=-},
kinky crosses/right/.style={@kinky cross=+},
kinky cross/.style args={(#1)--(#2)}{
to path={
let \p{@kc@}=($(\tikztotarget)-(\tikztostart)$),
\n{@kc@}={atan3(\p{@kc@})+180} in
-- ($(intersection of \tikztostart--{\tikztotarget} and #1--#2)!%
\pgfkeysvalueof{/tikz/kinky cross radius}!(\tikztostart)$)
arc [ radius =\pgfkeysvalueof{/tikz/kinky cross radius},
start angle=\n{@kc@},
delta angle=\pgfkeysvalueof{/tikz/@kinky cross}180 ]
-- (\tikztotarget)
}
}
}
\makeatother \makeatother
%!tikz preamble end %!tikz preamble end
@@ -64,33 +88,60 @@
\tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt] \tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]
%\draw (0,0) to[grid with coordinates] (10,5); \draw (0,0) to[grid with coordinates] (10,5);
% Koordinaten für Kreuzpunkte % Koordinaten für Kreuzpunkte
\coordinate (A) at (0.95,2.75); \coordinate (A) at (0.95,2.75);
\fill (A) circle (1pt); \fill (A) circle (1pt);% node{A};
\coordinate (B) at (0.95,0.5); \coordinate (B) at (0.95,0.5);
\fill (B) circle (1pt); \fill (B) circle (1pt);
\coordinate (C) at (0.55,2.75); \coordinate (C) at (0.55,2.75);
\fill (C) circle (1pt); %temp
\fill (C) circle (1pt) node{\tiny{C}};
\coordinate (D) at (2.5,1.4); \coordinate (D) at (2.5,1.4);
%temp
%\fill (D) circle (1pt) node{\tiny{D}};
\coordinate (E) at (0.75,0.5); \coordinate (E) at (0.75,0.5);
\fill (E) circle (1pt); \fill (E) circle (1pt) node[above]{\tiny{E}};
\coordinate (F) at (2.5,1.8); \coordinate (F) at (2.5,1.8);
%temp
\fill (F) circle (1pt) node{\tiny{F}};
\coordinate (G) at (4.2,2.58);
%temp
%\fill (G) circle (1pt) node{G};
\coordinate (H) at (4.2,0.666);
%temp
%\fill (H) circle (1pt) node{H};
\coordinate (I) at (6,1.6);
%temp
\fill (I) circle (1pt) node{I};
\coordinate (J) at (0.75,1.8);
\fill (J) circle (1pt) node[above]{\tiny{J}};
% Eingangsvariablen % Eingangsvariablen
\node (x2) at (0.2,0.5) {b}; \node (x2) at (0.2,0.5) {b};
\node (x1) at (0.2,2.75) {a}; \node (x1) at (0.2,2.75) {a};
% Ausgangsvariable % Ausgangsvariable
\node (y) at (5,0.5) {out}; \node (y) at (6.35, 1.62) {out};
% Gatter % Gatter
\node[nand gate] at (1.5,0.5) (n1) {}; \node[nand gate] at (1.5,0.5) (n1) {\tiny{N1}};
\node[nand gate] at (1.5,2.75) (n2) {}; \node[nand gate] at (1.5,2.75) (n2) {};
\node[nand gate] at (3.45,2.58) (n4) {}; \node[nand gate] at (3.45,2.58) (n4) {};
\node[nand gate] at (3.45,0.666) (n3) {}; \node[nand gate] at (3.45,0.666) (n3) {};
@@ -108,15 +159,31 @@
\draw(n2.output) -- (n4.input 1); \draw(n2.output) -- (n4.input 1);
\draw(C) |- (D); \draw(C) |- (D);
\draw(D) |- (n3.input 1); \draw(D) |- (n3.input 1);
\draw(E) |- (F); %\draw(E) |- (F);
\draw(F) |- (n4.input 2); %\draw(F) |- (n4.input 2);
\draw(n4.output) -- (n5.input 1); \draw(n4.output) -- (G);
% \draw(n1.output) -- (A); \draw(G) |- (n5.input 1);
% \draw(A) |- (n2.input 2); \draw(n3.output) -- (H);
% \draw(A) |- (n2.input 1); \draw(H) |- (n5.input 2);
% \draw(n2.output) -- (y); \draw(n5.output) -- (I);
% \draw(n1.output) to [short,l=\footnotesize{nandout}, -] (A);
%\node at (ORa.in 2)
%[
% below,
% jump crossing,
% rotate=-90,
% scale=1.3
%](X){\tiny{X}};
% \draw(n1.output) to [short,l=\footnotesize{nandout}, -] (A);
% \draw(1,-1) to[short] (1,1) (0,0) to[crossing] (2,0);
% \draw(C) |- (D) (E) to[crossing] (J);
% \draw (E) to [kinky cross=(C)--(D), kinky crosses=right](J); % /
\end{tikzpicture} \end{tikzpicture}
%!tikz source end %!tikz source end

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -40,4 +40,8 @@ CHIP CPU {
PARTS: PARTS:
// Put your code here: // Put your code here:
// 1. A/C-Instruction
Not(in=instruction[15],out=inst)
Mux(a=outM,)
} }