I've produced the following code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{circuitikz}
\begin{document}
\maketitle
\begin{circuitikz} \draw
(2,2) node[nand port, fill=green] (NANDMIDA) {}
(2,0) node[nand port] (NANDMIDB) {}
(NANDMIDA.out) -- ++(0,-0.5) -- ($(NANDMIDB.in 1) +(0,0.5)$) -- (NANDMIDB.in 1)
(NANDMIDB.out) -- ++(0,+0.5) -- ($(NANDMIDA.in 2) +(0,-0.5)$)--(NANDMIDA.in 2)
(NANDMIDA.out) -- ++(0,-0.5) -- ($(NANDMIDB.in 1) +(0,0.5)$) -- (NANDMIDB.in 1)
(NANDMIDB.out) -- ++(0,+0.5) -- ($(NANDMIDA.in 2) +(0,-0.5)$)--(NANDMIDA.in 2)
($(NANDMIDA.in 1) - (1, 0)$) node[nand port, anchor=out] (NANDTOPB) {}
($(NANDTOPB.out) + (0, 2)$) node[nand port, anchor=out, fill=red] (NANDTOPA) {}
(NANDTOPA.out) -- ++(0,-0.5) -- ($(NANDTOPB.in 1) +(0,0.5)$) -- (NANDTOPB.in 1)
(NANDTOPB.out) -- ++(0,+0.5) -- ($(NANDTOPA.in 2) +(0,-0.5)$)--(NANDTOPA.in 2)
(NANDTOPA.out) -- ++(0,-0.5) -- ($(NANDTOPB.in 1) +(0,0.5)$) -- (NANDTOPB.in 1)
(NANDTOPB.out) -- ++(0,+0.5) -- ($(NANDTOPA.in 2) +(0,-0.5)$)--(NANDTOPA.in 2)
($(NANDMIDB.in 2) - (1, 0)$) node[nand port, fill=blue, anchor=out] (NANDBOTTOMA) {}
($(NANDBOTTOMA.out) - (0, 2)$) node[nand port, anchor=out] (NANDBOTTOMB) {}
(NANDBOTTOMA.out) -- ++(0,-0.5) -- ($(NANDBOTTOMB.in 1) +(0,0.5)$) -- (NANDBOTTOMB.in 1)
(NANDBOTTOMB.out) -- ++(0,+0.5) -- ($(NANDBOTTOMA.in 2) +(0,-0.5)$)--(NANDBOTTOMA.in 2)
(NANDBOTTOMA.out) -- ++(0,-0.5) -- ($(NANDBOTTOMB.in 1) +(0,0.5)$) -- (NANDBOTTOMB.in 1)
(NANDBOTTOMB.out) -- ++(0,+0.5) -- ($(NANDBOTTOMA.in 2) +(0,-0.5)$)--(NANDBOTTOMA.in 2)
(NANDTOPB.out) -- (NANDMIDA.in 1)
(NANDBOTTOMA.out) -- (NANDMIDB.in 2)
% LINK FROM NANDTOPB OUT TO NANDBOTTOMA IN1
(NANDTOPB.out) -- ++(0,-0.5) -- ($(NANDBOTTOMA.in 1) +(0,+0.5)$)--(NANDBOTTOMA.in 1)
% LINK FROM NANDTOPA IN 1 TO NANDBOTTOMA IN2
(NANDTOPA.in 1) -- ++(-1,0) -- ($(NANDBOTTOMA.in 2) +(-1,0)$)--(NANDBOTTOMA.in 2)
% CLOCK LINK FROM NANDTOPB IN2 TO NANDTOPB IN1.5
(NANDTOPB.in 2) -- ++(-1.5,0) -- ($(NANDBOTTOMA.in 1) +(-1.5,-0.3)$)--($(NANDBOTTOMA.in 1)+(0.5, -0.3)$)
;
\draw (NANDMIDA.out) to [short, -o, l=$Q$] ++(0.5, 0);
\draw (NANDMIDB.out) to [short, -o, l=$\overline{Q}$] ++(0.5, 0);
\draw (NANDBOTTOMB.in 2) to [short, -o, l=$\emph{data}$]++(-1,0);
\draw ($(NANDTOPB.in 2)+(-1.5,0)$) to [short, -*] ($(NANDBOTTOMA.in 1) +(-1.5,1)$) coordinate (clockNode);
\draw (clockNode) to [short, -o, l=$\emph{clock}$] ++(-1.5, 0);
\draw (NANDTOPB.out) to [short, -*] ++(0,0);
\draw (NANDBOTTOMA.out) to [short, -*] ++(0.0,0);
\end{circuitikz}
\end{document}
and now I would like to highlight specific paths in the circuit differently like in the following picture:
I tried adding the color name between square brackets before the link I want to color but when I do so it will change the color for every link in the circuit.
circuitikz
see tex.stackexchange.com/questions/439536