| 1 |
.PS |
| 2 |
# ShiftR.m4 |
| 3 |
log_init(svg_font(sans-serif,11*0.9bp__)) |
| 4 |
textoffset = textht/6 |
| 5 |
|
| 6 |
define(`lg_plen',3) |
| 7 |
|
| 8 |
define(`customFF',`FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, |
| 9 |
:S;NE:CK;:R, N:PR, :Q;;ifelse(`$1',1,:svg_ol(Q)), N:CLR,,)') |
| 10 |
|
| 11 |
F0: customFF(1) |
| 12 |
|
| 13 |
BUFFER_gate(,N) with .Out at F0.W1.end |
| 14 |
line left 2*L_unit from last [].In1 |
| 15 |
T: dot |
| 16 |
reversed(`NOT_gate',left 10*L_unit) |
| 17 |
{move left textht*8} |
| 18 |
Serial: "SERIAL" rjust "INPUT" rjust |
| 19 |
line from T to (T,F0.W3) then to F0.W3.end |
| 20 |
|
| 21 |
NCLR: NOT_gate(right T.x-Serial.x from (Serial,F0.S1.end),N) |
| 22 |
"svg_ol(CLEAR)" wid 33bp__ at NCLR.start rjust |
| 23 |
|
| 24 |
CLK: NOT_gate(right T.x-Serial.x from NCLR.start+(0,-BUF_ht*3/2*L_unit)) |
| 25 |
"CLOCK" at CLK.start rjust |
| 26 |
|
| 27 |
for_(1,4,1,` |
| 28 |
F`'m4x: customFF(eval(m4x!=4)) with .W3.end at F`'eval(m4x-1).E3.end |
| 29 |
') |
| 30 |
|
| 31 |
"OUTPUT" wid 0.7 at F4.E1.end ljust |
| 32 |
line from NCLR.end to F4.S1.end |
| 33 |
|
| 34 |
down_ |
| 35 |
for_(0,4,1,` |
| 36 |
line from F`'m4x.W2.end down F0.W2.y-CLK.y |
| 37 |
ifelse(eval(m4x!=4),1,`dot',`line to CLK.end') |
| 38 |
N`'m4x: NAND_gate with .Out at F`'m4x.N1.end |
| 39 |
line up 2*L_unit from N`'m4x.In2 |
| 40 |
{ line up 6*L_unit from N`'m4x.In1 |
| 41 |
"PR`'eval(4-m4x)" rjust } |
| 42 |
ifelse(eval(m4x!=4),1, |
| 43 |
`dot; dot(at F`'m4x.S1.end)', |
| 44 |
`line to (Serial,Here) |
| 45 |
"PRESET" rjust "ENABLE" rjust ') |
| 46 |
') |
| 47 |
|
| 48 |
command "</g>" # end font |
| 49 |
.PE |