CPU Register concept sketch using TikZ


I want to draw a CPU register set as shown at my hand-made concept draw:

enter image description here

My LaTeX source so far is:


\StrLen{Register Rx}[\RegStrLen]


  row 1/.style={nodes={text height=0},font=\scriptsize},draw=none,
  column 1/.style={nodes={draw}},
  column 2/.style={nodes={draw,minimum width=\RegStrLen}},
  column 3/.style={nodes={draw,minimum width=\RegStrLen}}
  \node[anchor=east] {31}; & & \node[anchor=west] {0}; \\
  & \node {R0}; \\
  & \node {R1}; \\
  & \node {R2}; \\
  & \node {R3}; \\
  & \node {R4}; \\


It fails to get the right border drawn around the R(egister)-labeled columns, where the first column doesn't have it. The MSB und LSB (31 und 0) shall be aligned to the left, resp. right side.

Getting curly braces – I also failed 🙁 As well as to draw the so-called shadow-registers A and B, the text around …

Not the AI help of CoCalc, the VisualTikZ nor PGF Manual gave me a hint how to accomplish my task/wish. I also searched at StackExchange for those solution hints without results.

At least the fontsize of the first column looks promising 🙂
So, what could be a solution using TikZ?

Best Answer

Something like this?

enter image description here

  • You should include your sketch to question. After while given link may become death ...
  • Sorry, but some of your hand writing text is unreadable to me, so you need to insert correct text yourself.
  • Also color of cells is not visible well, consequently in picture they may be wrongly interpreted-

As starting point:

                calligraphy,% had to be after decorations.pathreplacing


 node distance = 0mm and 7mm,
   start chain = A going below,
BC/.style args = {#1/#2/#3}{
        decoration={calligraphic brace, amplitude=6pt,
        pre =moveto, pre  length=1pt,
        post=moveto, post length=1pt,
              #2},% for mirroring of brace
        pen colour={#3}
 N/.style = {draw, fill=#1, minimum height=7mm, minimum width=21mm, outer sep=0pt,
             text opacity=1, align=center},
 N/.default = gray!30,
\begin{scope}[nodes=on chain]
\foreach \i in {0, 1,...,4} 
\node[N] {R\i}; 
\node[N=white] {R\i};
\node[above] at (A-1.north west) {31};
\node[above] at (A-1.north east) {1};
\node (a) [N, fill opacity=0.5, above right=of A-4.east,
           label=right:text]     {A};
\node (b) [N, fill opacity=0.5, right=3mm of A-4]  {B};
\node[right=of b]  {text};
    \draw[densely dashed]   (A-4.north east) -- (a.north west)
                            (A-4.south east) -- (b.south west);
\node (n1)  [above=3mm] at (A-1.north)  {text};
\node (n3)              at (n1 -| a)    {text};
\draw[BC=1/ /red]  (A-1.north east) -- node[right=3mm] {text} (A-3.south east);
\draw[BC=1/mirror/red]  (A-1.north west) -- node[left=3mm] {Low}    (A-2.south west);
\draw[BC=1/mirror/red]  (A-3.north west) -- node[left=3mm] {Hight}  (A-4.south west);
\node[left=3mm of A-5] {Foo};