plunkerでsimcirjs その6

#概要

plunkerでsimcirjsやってみた。
4入力3出力加算器作ってみた。

#写真

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/6ca00ee7-3e35-6755-d183-969a08c6423c.png)

#真理値表



| a | b | c | d | s0 | s1 | s2 |
|:---|:--|:--|:--|:--|:--|:--|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 1 | 0 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 1 | 1 |

#サンプルコード

```
{
  "width":800,
  "height":400,
  "showToolbox":true,
  "toolbox":[
    {"type":"In"},
    {"type":"Out"},
    {"type":"Joint"},
    {"type":"DC"},
    {"type":"LED"},
    {"type":"PushOff"},
    {"type":"PushOn"},
    {"type":"Toggle"},
    {"type":"BUF"},
    {"type":"NOT"},
    {"type":"AND"},
    {"type":"NAND"},
    {"type":"OR"},
    {"type":"NOR"},
    {"type":"XOR"},
    {"type":"XNOR"},
    {"type":"OSC"},
    {"type":"7seg"},
    {"type":"16seg"},
    {"type":"4bit7seg"},
    {"type":"RotaryEncoder"},
    {"type":"BusIn"},
    {"type":"BusOut"},
    {"type":"RS-FF"},
    {"type":"JK-FF"},
    {"type":"T-FF"},
    {"type":"D-FF"},
    {"type":"8bitCounter"},
    {"type":"HalfAdder"},
    {"type":"FullAdder"},
    {"type":"4bitAdder"},
    {"type":"2to4BinaryDecoder"},
    {"type":"3to8BinaryDecoder"},
    {"type":"4to16BinaryDecoder"},
    {"type":"AltFullAdder"},
    {"type":"Transmitter"},
    {"type":"Delay"},
    {"type":"NumSrc"},
    {"type":"NumDsp"},
    {"type":"DSO"}
  ],
  "devices":[
    {"type":"DC","id":"dev0","x":96,"y":120,"label":"DC"},
    {"type":"LED","id":"dev1","x":216,"y":112,"label":"LED"},
    {"type":"Toggle","id":"dev2","x":160,"y":184,"label":"Toggle","state":{"on":false}},
    {"type":"LED","id":"dev3","x":216,"y":264,"label":"LED"},
    {"type":"LED","id":"dev4","x":216,"y":336,"label":"LED"},
    {"type":"LED","id":"dev5","x":552,"y":216,"label":"LED"},
    {"type":"LED","id":"dev6","x":552,"y":112,"label":"LED"},
    {"type":"LED","id":"dev7","x":552,"y":32,"label":"LED"},
    {"type":"XOR","id":"dev8","x":312,"y":56,"label":"XOR"},
    {"type":"XOR","id":"dev9","x":312,"y":136,"label":"XOR"},
    {"type":"XOR","id":"dev10","x":416,"y":64,"label":"XOR"},
    {"type":"FullAdder","id":"dev11","x":320,"y":216,"label":"FullAdder"},
    {"type":"HalfAdder","id":"dev12","x":416,"y":264,"label":"HalfAdder"},
    {"type":"Toggle","id":"dev13","x":160,"y":40,"label":"Toggle","state":{"on":false}},
    {"type":"LED","id":"dev14","x":216,"y":184,"label":"LED"},
    {"type":"Toggle","id":"dev15","x":160,"y":120,"label":"Toggle","state":{"on":false}},
    {"type":"Toggle","id":"dev16","x":160,"y":256,"label":"Toggle","state":{"on":false}}
  ],
  "connectors":[
    {"from":"dev1.in0","to":"dev13.out0"},
    {"from":"dev2.in0","to":"dev0.out0"},
    {"from":"dev3.in0","to":"dev2.out0"},
    {"from":"dev4.in0","to":"dev16.out0"},
    {"from":"dev5.in0","to":"dev12.out1"},
    {"from":"dev6.in0","to":"dev11.out1"},
    {"from":"dev7.in0","to":"dev10.out0"},
    {"from":"dev8.in0","to":"dev13.out0"},
    {"from":"dev8.in1","to":"dev15.out0"},
    {"from":"dev9.in0","to":"dev2.out0"},
    {"from":"dev9.in1","to":"dev16.out0"},
    {"from":"dev10.in0","to":"dev8.out0"},
    {"from":"dev10.in1","to":"dev9.out0"},
    {"from":"dev11.in0","to":"dev13.out0"},
    {"from":"dev11.in1","to":"dev15.out0"},
    {"from":"dev11.in2","to":"dev2.out0"},
    {"from":"dev12.in0","to":"dev11.out0"},
    {"from":"dev12.in1","to":"dev16.out0"},
    {"from":"dev13.in0","to":"dev0.out0"},
    {"from":"dev14.in0","to":"dev15.out0"},
    {"from":"dev15.in0","to":"dev0.out0"},
    {"from":"dev16.in0","to":"dev0.out0"}
  ]
}
```

#成果物

https://embed.plnkr.co/3dCoIPA2wKI3HAO36sId/

以上。