forked from kazuhikoarase/simcirjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my-devices.js
executable file
·155 lines (153 loc) · 6.51 KB
/
my-devices.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
simcir.registerDevice('JK-FF(CP)',
{
"width":500,
"height":300,
"showToolbox":false,
"toolbox":[
],
"devices":[
{"type":"Toggle","id":"dev0","x":88,"y":136,"label":"Toggle","state":{"on":false}},
{"type":"In","id":"dev1","x":136,"y":40,"label":"J"},
{"type":"DC","id":"dev2","x":24,"y":120,"label":"DC"},
{"type":"In","id":"dev3","x":136,"y":88,"label":"CLK"},
{"type":"In","id":"dev4","x":136,"y":136,"label":"K"},
{"type":"AND","numInputs":"3","label":"AND(3)","id":"dev5","x":192,"y":40},
{"type":"NOT","id":"dev6","x":192,"y":88,"label":"NOT"},
{"type":"AND","numInputs":"3","label":"AND(3)","id":"dev7","x":192,"y":136},
{"type":"NOR","numInputs":"3","label":"NOR(3)","id":"dev8","x":248,"y":48},
{"type":"NOR","numInputs":"3","label":"NOR(3)","id":"dev9","x":248,"y":136},
{"type":"AND","id":"dev10","x":304,"y":72,"label":"AND"},
{"type":"AND","id":"dev11","x":304,"y":120,"label":"AND"},
{"type":"Out","id":"dev12","x":432,"y":72,"label":"Q"},
{"type":"PushOn","id":"dev13","x":88,"y":88,"label":"PushOn"},
{"type":"Toggle","id":"dev14","x":88,"y":40,"label":"Toggle","state":{"on":false}},
{"type":"NOR","id":"dev15","x":360,"y":72,"label":"NOR"},
{"type":"Out","id":"dev16","x":432,"y":136,"label":"~Q"},
{"type":"NOR","id":"dev17","x":360,"y":136,"label":"NOR"},
{"type":"NOT","id":"dev18","x":192,"y":232,"label":"NOT"},
{"type":"NOT","id":"dev19","x":192,"y":184,"label":"NOT"},
{"type":"PushOff","id":"dev20","x":88,"y":184,"label":"PushOff"},
{"type":"In","id":"dev21","x":136,"y":232,"label":"~CLR"},
{"type":"In","id":"dev22","x":136,"y":184,"label":"~PRE"},
{"type":"PushOff","id":"dev23","x":88,"y":232,"label":"PushOff"}
],
"connectors":[
{"from":"dev0.in0","to":"dev2.out0"},
{"from":"dev1.in0","to":"dev14.out0"},
{"from":"dev3.in0","to":"dev13.out0"},
{"from":"dev4.in0","to":"dev0.out0"},
{"from":"dev5.in0","to":"dev17.out0"},
{"from":"dev5.in1","to":"dev1.out0"},
{"from":"dev5.in2","to":"dev3.out0"},
{"from":"dev6.in0","to":"dev3.out0"},
{"from":"dev7.in0","to":"dev3.out0"},
{"from":"dev7.in1","to":"dev4.out0"},
{"from":"dev7.in2","to":"dev15.out0"},
{"from":"dev8.in0","to":"dev5.out0"},
{"from":"dev8.in1","to":"dev19.out0"},
{"from":"dev8.in2","to":"dev9.out0"},
{"from":"dev9.in0","to":"dev8.out0"},
{"from":"dev9.in1","to":"dev7.out0"},
{"from":"dev9.in2","to":"dev18.out0"},
{"from":"dev10.in0","to":"dev8.out0"},
{"from":"dev10.in1","to":"dev6.out0"},
{"from":"dev11.in0","to":"dev6.out0"},
{"from":"dev11.in1","to":"dev9.out0"},
{"from":"dev12.in0","to":"dev15.out0"},
{"from":"dev13.in0","to":"dev2.out0"},
{"from":"dev14.in0","to":"dev2.out0"},
{"from":"dev15.in0","to":"dev10.out0"},
{"from":"dev15.in1","to":"dev17.out0"},
{"from":"dev16.in0","to":"dev17.out0"},
{"from":"dev17.in0","to":"dev15.out0"},
{"from":"dev17.in1","to":"dev11.out0"},
{"from":"dev18.in0","to":"dev21.out0"},
{"from":"dev19.in0","to":"dev22.out0"},
{"from":"dev20.in0","to":"dev2.out0"},
{"from":"dev21.in0","to":"dev23.out0"},
{"from":"dev22.in0","to":"dev20.out0"},
{"from":"dev23.in0","to":"dev2.out0"}
]
}
);
simcir.registerDevice("D-FF(CP)",
{
"width":400,
"height":250,
"showToolbox":false,
"toolbox":[
],
"devices":[
{"type":"In","id":"dev0","x":128,"y":72,"label":"CLK"},
{"type":"In","id":"dev1","x":128,"y":24,"label":"D"},
{"type":"In","id":"dev2","x":128,"y":120,"label":"~PRE"},
{"type":"In","id":"dev3","x":128,"y":168,"label":"~CLR"},
{"type":"JK-FF(CP)","id":"dev4","x":224,"y":80,"label":"JK-FF(CP)"},
{"type":"Out","id":"dev5","x":304,"y":128,"label":"~Q"},
{"type":"Out","id":"dev6","x":304,"y":80,"label":"Q"},
{"type":"Toggle","id":"dev7","x":80,"y":24,"label":"Toggle","state":{"on":false}},
{"type":"NOT","id":"dev8","x":176,"y":72,"label":"NOT"},
{"type":"PushOff","id":"dev9","x":80,"y":168,"label":"PushOff"},
{"type":"DC","id":"dev10","x":24,"y":104,"label":"DC"},
{"type":"PushOn","id":"dev11","x":80,"y":72,"label":"PushOn"},
{"type":"PushOff","id":"dev12","x":80,"y":120,"label":"PushOff"}
],
"connectors":[
{"from":"dev0.in0","to":"dev11.out0"},
{"from":"dev1.in0","to":"dev7.out0"},
{"from":"dev2.in0","to":"dev12.out0"},
{"from":"dev3.in0","to":"dev9.out0"},
{"from":"dev4.in0","to":"dev1.out0"},
{"from":"dev4.in1","to":"dev0.out0"},
{"from":"dev4.in2","to":"dev8.out0"},
{"from":"dev4.in3","to":"dev2.out0"},
{"from":"dev4.in4","to":"dev3.out0"},
{"from":"dev5.in0","to":"dev4.out1"},
{"from":"dev6.in0","to":"dev4.out0"},
{"from":"dev7.in0","to":"dev10.out0"},
{"from":"dev8.in0","to":"dev1.out0"},
{"from":"dev9.in0","to":"dev10.out0"},
{"from":"dev11.in0","to":"dev10.out0"},
{"from":"dev12.in0","to":"dev10.out0"}
]
}
);
simcir.registerDevice("MUX",
{
"width":500,
"height":300,
"showToolbox":false,
"toolbox":[
],
"devices":[
{"type":"Toggle","id":"dev0","x":112,"y":72,"label":"Toggle","state":{"on":false}},
{"type":"DC","id":"dev1","x":56,"y":144,"label":"DC"},
{"type":"NOT","id":"dev2","x":224,"y":120,"label":"NOT"},
{"type":"Toggle","id":"dev3","x":112,"y":144,"label":"Toggle","state":{"on":false}},
{"type":"In","id":"dev4","x":176,"y":72,"label":"D0"},
{"type":"In","id":"dev5","x":176,"y":216,"label":"D1"},
{"type":"In","id":"dev6","x":176,"y":144,"label":"S"},
{"type":"AND","id":"dev7","x":264,"y":208,"label":"AND"},
{"type":"AND","id":"dev8","x":264,"y":80,"label":"AND"},
{"type":"OR","id":"dev9","x":312,"y":144,"label":"OR"},
{"type":"Out","id":"dev10","x":384,"y":144,"label":"Y"},
{"type":"Toggle","id":"dev11","x":112,"y":216,"label":"Toggle","state":{"on":false}}
],
"connectors":[
{"from":"dev0.in0","to":"dev1.out0"},
{"from":"dev2.in0","to":"dev6.out0"},
{"from":"dev3.in0","to":"dev1.out0"},
{"from":"dev4.in0","to":"dev0.out0"},
{"from":"dev5.in0","to":"dev11.out0"},
{"from":"dev6.in0","to":"dev3.out0"},
{"from":"dev7.in0","to":"dev6.out0"},
{"from":"dev7.in1","to":"dev5.out0"},
{"from":"dev8.in0","to":"dev4.out0"},
{"from":"dev8.in1","to":"dev2.out0"},
{"from":"dev9.in0","to":"dev8.out0"},
{"from":"dev9.in1","to":"dev7.out0"},
{"from":"dev10.in0","to":"dev9.out0"},
{"from":"dev11.in0","to":"dev1.out0"}
]
}
);