SimcirJSで乗算機を作ってみた

動作が不安定です.
# 概要
乗算機を作ってみた.

# 写真
![get_and_set.html および他 8 ページ - プロファイル 1 - Microsoft​ Edge 2024_12_04 18_07_04.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3926274/f8d28050-1789-483e-1ef5-043c32b18bad.png)

# 仕組みの解説
左上のものはカウンタ回路です.`a`の入力した回繰り返します.
その右のものは加算器でカウンタ回路の信号を受け`b`の入力を加算します.

`c`でいうと
```c
int a,b;
int out;
for (int i=0;i<=a;i++):{
    out += b; 
}
```
みたいな感じです.


# コード
めっちゃ長いです.
```
{
  "width":1500,
  "height":800,
  "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"}
  ],
  "devices":[
    {"type":"4bitAdder","id":"dev0","x":296,"y":528,"label":"4bitAdder"},
    {"type":"AND","id":"dev1","x":360,"y":416,"label":"AND"},
    {"type":"AND","id":"dev2","x":360,"y":448,"label":"AND"},
    {"type":"AND","id":"dev3","x":360,"y":480,"label":"AND"},
    {"type":"AND","id":"dev4","x":360,"y":512,"label":"AND"},
    {"type":"AND","id":"dev5","x":360,"y":544,"label":"AND"},
    {"type":"AND","id":"dev6","x":360,"y":576,"label":"AND"},
    {"type":"AND","id":"dev7","x":360,"y":608,"label":"AND"},
    {"type":"AND","id":"dev8","x":360,"y":640,"label":"AND"},
    {"type":"D-FF","id":"dev9","x":392,"y":416,"label":"D-FF"},
    {"type":"D-FF","id":"dev10","x":392,"y":448,"label":"D-FF"},
    {"type":"D-FF","id":"dev11","x":392,"y":480,"label":"D-FF"},
    {"type":"D-FF","id":"dev12","x":392,"y":512,"label":"D-FF"},
    {"type":"D-FF","id":"dev13","x":392,"y":544,"label":"D-FF"},
    {"type":"D-FF","id":"dev14","x":392,"y":576,"label":"D-FF"},
    {"type":"D-FF","id":"dev15","x":392,"y":608,"label":"D-FF"},
    {"type":"4bitAdder","id":"dev16","x":296,"y":384,"label":"4bitAdder"},
    {"type":"D-FF","id":"dev17","x":168,"y":320,"label":"D-FF"},
    {"type":"D-FF","id":"dev18","x":168,"y":384,"label":"D-FF"},
    {"type":"D-FF","id":"dev19","x":168,"y":416,"label":"D-FF"},
    {"type":"4bitAdder","id":"dev20","x":72,"y":304,"label":"4bitAdder"},
    {"type":"D-FF","id":"dev21","x":168,"y":352,"label":"D-FF"},
    {"type":"XNOR","id":"dev22","x":232,"y":320,"label":"XNOR"},
    {"type":"XNOR","id":"dev23","x":232,"y":352,"label":"XNOR"},
    {"type":"XNOR","id":"dev24","x":232,"y":384,"label":"XNOR"},
    {"type":"XNOR","id":"dev25","x":232,"y":416,"label":"XNOR"},
    {"type":"AND","id":"dev26","x":264,"y":416,"label":"AND"},
    {"type":"AND","id":"dev27","x":264,"y":384,"label":"AND"},
    {"type":"AND","id":"dev28","x":136,"y":320,"label":"AND"},
    {"type":"AND","id":"dev29","x":136,"y":352,"label":"AND"},
    {"type":"AND","id":"dev30","x":136,"y":384,"label":"AND"},
    {"type":"OR","id":"dev31","x":264,"y":448,"label":"OR"},
    {"type":"LED","id":"dev32","x":456,"y":416,"label":"LED"},
    {"type":"LED","id":"dev33","x":456,"y":448,"label":"LED"},
    {"type":"LED","id":"dev34","x":456,"y":480,"label":"LED"},
    {"type":"LED","id":"dev35","x":456,"y":512,"label":"LED"},
    {"type":"LED","id":"dev36","x":456,"y":544,"label":"LED"},
    {"type":"LED","id":"dev37","x":456,"y":576,"label":"LED"},
    {"type":"LED","id":"dev38","x":456,"y":608,"label":"LED"},
    {"type":"LED","id":"dev39","x":456,"y":640,"label":"LED"},
    {"type":"AND","id":"dev40","x":64,"y":584,"label":"AND"},
    {"type":"AND","id":"dev41","x":128,"y":688,"label":"AND"},
    {"type":"8bitCounter","id":"dev42","x":160,"y":632,"label":"8bitCounter"},
    {"type":"AND","id":"dev43","x":136,"y":416,"label":"AND"},
    {"type":"4bit7seg","id":"dev44","x":264,"y":320,"label":"a"},
    {"type":"4bit7seg","id":"dev45","x":328,"y":320,"label":"register"},
    {"type":"LED","id":"dev46","x":136,"y":288,"label":"LED"},
    {"type":"LED","id":"dev47","x":168,"y":288,"label":"LED"},
    {"type":"LED","id":"dev48","x":200,"y":288,"label":"LED"},
    {"type":"AND","id":"dev49","x":264,"y":480,"label":"AND"},
    {"type":"LED","id":"dev50","x":232,"y":288,"label":"LED"},
    {"type":"OSC","id":"dev51","x":96,"y":688,"label":"OSC"},
    {"type":"AND","id":"dev52","x":200,"y":448,"label":"AND"},
    {"type":"AND","id":"dev53","x":232,"y":448,"label":"AND"},
    {"type":"AND","id":"dev54","x":136,"y":448,"label":"AND"},
    {"type":"NOT","id":"dev55","x":200,"y":480,"label":"NOT"},
    {"type":"NAND","id":"dev56","x":8,"y":456,"label":"clock"},
    {"type":"NOT","id":"dev57","x":168,"y":448,"label":"NOT"},
    {"type":"BUF","id":"dev58","x":264,"y":512,"label":"BUF"},
    {"type":"BUF","id":"dev59","x":264,"y":544,"label":"BUF"},
    {"type":"AND","id":"dev60","x":40,"y":304,"label":"AND"},
    {"type":"DC","id":"dev61","x":16,"y":304,"label":"DC"},
    {"type":"DC","id":"dev62","x":64,"y":528,"label":"DC"},
    {"type":"BUF","id":"dev63","x":216,"y":560,"label":"clock_import"},
    {"type":"8bitCounter","id":"dev64","x":112,"y":488,"label":"run_speed"},
    {"type":"D-FF","id":"dev65","x":392,"y":640,"label":"D-FF"},
    {"type":"Toggle","id":"dev66","x":24,"y":632,"label":"clock_switch","state":{"on":false}},
    {"type":"Toggle","id":"dev67","x":72,"y":632,"label":"run","state":{"on":false}},
    {"type":"AND","id":"dev68","x":120,"y":632,"label":"AND"},
    {"type":"RotaryEncoder","id":"dev69","x":352,"y":680,"label":"RotaryEncoder"},
    {"type":"4bit7seg","id":"dev70","x":416,"y":680,"label":"a"},
    {"type":"RotaryEncoder","id":"dev71","x":480,"y":680,"label":"RotaryEncoder"},
    {"type":"4bit7seg","id":"dev72","x":544,"y":680,"label":"b"},
    {"type":"4bit7seg","id":"dev73","x":672,"y":680,"label":"out"},
    {"type":"4bit7seg","id":"dev74","x":736,"y":680,"label":"out"},
    {"type":"DC","id":"dev75","x":200,"y":512,"label":"DC"},
    {"type":"LED","id":"dev76","x":248,"y":728,"label":"reset"},
    {"type":"LED","id":"dev77","x":280,"y":728,"label":"clock"},
    {"type":"LED","id":"dev78","x":312,"y":728,"label":"run"},
    {"type":"BUF","id":"dev79","x":256,"y":688,"label":"reset_import"}
  ],
  "connectors":[
    {"from":"dev0.in0","to":"dev16.out4"},
    {"from":"dev0.in1","to":"dev13.out0"},
    {"from":"dev0.in2","to":"dev14.out0"},
    {"from":"dev0.in3","to":"dev15.out0"},
    {"from":"dev0.in4","to":"dev65.out0"},
    {"from":"dev1.in0","to":"dev16.out0"},
    {"from":"dev1.in1","to":"dev59.out0"},
    {"from":"dev2.in0","to":"dev16.out1"},
    {"from":"dev2.in1","to":"dev59.out0"},
    {"from":"dev3.in0","to":"dev16.out2"},
    {"from":"dev3.in1","to":"dev59.out0"},
    {"from":"dev4.in0","to":"dev16.out3"},
    {"from":"dev4.in1","to":"dev59.out0"},
    {"from":"dev5.in0","to":"dev0.out0"},
    {"from":"dev5.in1","to":"dev59.out0"},
    {"from":"dev6.in0","to":"dev0.out1"},
    {"from":"dev6.in1","to":"dev59.out0"},
    {"from":"dev7.in0","to":"dev0.out2"},
    {"from":"dev7.in1","to":"dev59.out0"},
    {"from":"dev8.in0","to":"dev0.out3"},
    {"from":"dev8.in1","to":"dev59.out0"},
    {"from":"dev9.in0","to":"dev1.out0"},
    {"from":"dev9.in1","to":"dev58.out0"},
    {"from":"dev10.in0","to":"dev2.out0"},
    {"from":"dev10.in1","to":"dev58.out0"},
    {"from":"dev11.in0","to":"dev3.out0"},
    {"from":"dev11.in1","to":"dev58.out0"},
    {"from":"dev12.in0","to":"dev4.out0"},
    {"from":"dev12.in1","to":"dev58.out0"},
    {"from":"dev13.in0","to":"dev5.out0"},
    {"from":"dev13.in1","to":"dev58.out0"},
    {"from":"dev14.in0","to":"dev6.out0"},
    {"from":"dev14.in1","to":"dev58.out0"},
    {"from":"dev15.in0","to":"dev7.out0"},
    {"from":"dev15.in1","to":"dev58.out0"},
    {"from":"dev16.in1","to":"dev9.out0"},
    {"from":"dev16.in2","to":"dev10.out0"},
    {"from":"dev16.in3","to":"dev11.out0"},
    {"from":"dev16.in4","to":"dev12.out0"},
    {"from":"dev16.in5","to":"dev71.out0"},
    {"from":"dev16.in6","to":"dev71.out1"},
    {"from":"dev16.in7","to":"dev71.out2"},
    {"from":"dev16.in8","to":"dev71.out3"},
    {"from":"dev17.in0","to":"dev28.out0"},
    {"from":"dev17.in1","to":"dev31.out0"},
    {"from":"dev18.in0","to":"dev30.out0"},
    {"from":"dev18.in1","to":"dev31.out0"},
    {"from":"dev19.in0","to":"dev43.out0"},
    {"from":"dev19.in1","to":"dev31.out0"},
    {"from":"dev20.in0","to":"dev60.out0"},
    {"from":"dev20.in1","to":"dev17.out0"},
    {"from":"dev20.in2","to":"dev21.out0"},
    {"from":"dev20.in3","to":"dev18.out0"},
    {"from":"dev20.in4","to":"dev19.out0"},
    {"from":"dev21.in0","to":"dev29.out0"},
    {"from":"dev21.in1","to":"dev31.out0"},
    {"from":"dev22.in0","to":"dev17.out0"},
    {"from":"dev22.in1","to":"dev69.out0"},
    {"from":"dev23.in0","to":"dev21.out0"},
    {"from":"dev23.in1","to":"dev69.out1"},
    {"from":"dev24.in0","to":"dev18.out0"},
    {"from":"dev24.in1","to":"dev69.out2"},
    {"from":"dev25.in0","to":"dev19.out0"},
    {"from":"dev25.in1","to":"dev69.out3"},
    {"from":"dev26.in0","to":"dev24.out0"},
    {"from":"dev26.in1","to":"dev25.out0"},
    {"from":"dev27.in0","to":"dev22.out0"},
    {"from":"dev27.in1","to":"dev23.out0"},
    {"from":"dev28.in0","to":"dev20.out0"},
    {"from":"dev28.in1","to":"dev67.out0"},
    {"from":"dev29.in0","to":"dev20.out1"},
    {"from":"dev29.in1","to":"dev67.out0"},
    {"from":"dev30.in0","to":"dev20.out2"},
    {"from":"dev30.in1","to":"dev67.out0"},
    {"from":"dev31.in0","to":"dev52.out0"},
    {"from":"dev31.in1","to":"dev53.out0"},
    {"from":"dev32.in0","to":"dev9.out0"},
    {"from":"dev33.in0","to":"dev10.out0"},
    {"from":"dev34.in0","to":"dev11.out0"},
    {"from":"dev35.in0","to":"dev12.out0"},
    {"from":"dev36.in0","to":"dev13.out0"},
    {"from":"dev37.in0","to":"dev14.out0"},
    {"from":"dev38.in0","to":"dev15.out0"},
    {"from":"dev39.in0","to":"dev65.out0"},
    {"from":"dev40.in0","to":"dev66.out0"},
    {"from":"dev40.in1","to":"dev67.out0"},
    {"from":"dev41.in0","to":"dev66.out0"},
    {"from":"dev41.in1","to":"dev51.out0"},
    {"from":"dev42.in0","to":"dev62.out0"},
    {"from":"dev42.in1","to":"dev41.out0"},
    {"from":"dev43.in0","to":"dev20.out3"},
    {"from":"dev43.in1","to":"dev67.out0"},
    {"from":"dev44.in0","to":"dev69.out0"},
    {"from":"dev44.in1","to":"dev69.out1"},
    {"from":"dev44.in2","to":"dev69.out2"},
    {"from":"dev44.in3","to":"dev69.out3"},
    {"from":"dev45.in0","to":"dev17.out0"},
    {"from":"dev45.in1","to":"dev21.out0"},
    {"from":"dev45.in2","to":"dev18.out0"},
    {"from":"dev45.in3","to":"dev19.out0"},
    {"from":"dev46.in0","to":"dev17.out0"},
    {"from":"dev47.in0","to":"dev21.out0"},
    {"from":"dev48.in0","to":"dev18.out0"},
    {"from":"dev49.in0","to":"dev27.out0"},
    {"from":"dev49.in1","to":"dev26.out0"},
    {"from":"dev50.in0","to":"dev19.out0"},
    {"from":"dev52.in0","to":"dev54.out0"},
    {"from":"dev52.in1","to":"dev67.out0"},
    {"from":"dev53.in0","to":"dev55.out0"},
    {"from":"dev53.in1","to":"dev79.out0"},
    {"from":"dev54.in0","to":"dev57.out0"},
    {"from":"dev54.in1","to":"dev63.out0"},
    {"from":"dev55.in0","to":"dev67.out0"},
    {"from":"dev56.in0","to":"dev56.out0"},
    {"from":"dev56.in1","to":"dev40.out0"},
    {"from":"dev57.in0","to":"dev49.out0"},
    {"from":"dev58.in0","to":"dev31.out0"},
    {"from":"dev59.in0","to":"dev67.out0"},
    {"from":"dev60.in0","to":"dev61.out0"},
    {"from":"dev60.in1","to":"dev67.out0"},
    {"from":"dev63.in0","to":"dev64.out7"},
    {"from":"dev64.in0","to":"dev62.out0"},
    {"from":"dev64.in1","to":"dev56.out0"},
    {"from":"dev65.in0","to":"dev8.out0"},
    {"from":"dev65.in1","to":"dev58.out0"},
    {"from":"dev66.in0","to":"dev61.out0"},
    {"from":"dev67.in0","to":"dev62.out0"},
    {"from":"dev68.in0","to":"dev67.out0"},
    {"from":"dev68.in1","to":"dev66.out0"},
    {"from":"dev69.in0","to":"dev75.out0"},
    {"from":"dev70.in0","to":"dev69.out0"},
    {"from":"dev70.in1","to":"dev69.out1"},
    {"from":"dev70.in2","to":"dev69.out2"},
    {"from":"dev70.in3","to":"dev69.out3"},
    {"from":"dev71.in0","to":"dev75.out0"},
    {"from":"dev72.in0","to":"dev71.out0"},
    {"from":"dev72.in1","to":"dev71.out1"},
    {"from":"dev72.in2","to":"dev71.out2"},
    {"from":"dev72.in3","to":"dev71.out3"},
    {"from":"dev73.in0","to":"dev13.out0"},
    {"from":"dev73.in1","to":"dev14.out0"},
    {"from":"dev73.in2","to":"dev15.out0"},
    {"from":"dev73.in3","to":"dev65.out0"},
    {"from":"dev74.in0","to":"dev9.out0"},
    {"from":"dev74.in1","to":"dev10.out0"},
    {"from":"dev74.in2","to":"dev11.out0"},
    {"from":"dev74.in3","to":"dev12.out0"},
    {"from":"dev76.in0","to":"dev53.out0"},
    {"from":"dev77.in0","to":"dev52.out0"},
    {"from":"dev78.in0","to":"dev68.out0"},
    {"from":"dev79.in0","to":"dev42.out1"}
  ]
}
```