SimcirJS
SimcirJS(a.k.a. Simcir) is a circuit simulator in HTML5 and JavaScript.
Let's try your circuit!
Usage
Choose a device from the toolbox and move to right side.
Connect them by drag operation.
Click an input node to disconnect.
Move a device back to the toolbox if you don't use.
Ctrl+Click(Mac:command+Click) to toggle view (Live circuit or JSON data).
Double-Click a label to edit device name.
Double-Click a library to open the circuit inside.
In Out Joint DC LED PushOff PushOn Toggle BUF NOT AND NAND OR NOR XOR XNOR OSC 7seg 16seg 4bit7seg RotaryEncoder x8 BusIn x8 BusOut ~S ~R Q ~Q RS-FF J CLK K Q ~Q JK-FF T CLK Q ~Q T-FF D CLK Q ~Q D-FF T CLK D0 D1 D2 D3 D4 D5 D6 D7 8bitCounter A B S C HalfAdder Cin A B S Cout FullAdder Cin A0 A1 A2 A3 B0 B1 B2 B3 S0 S1 S2 S3 Cout 4bitAdder D0 D1 OE A0 A1 A2 A3 2to4BinaryDecoder D0 D1 D2 OE A0 A1 A2 A3 A4 A5 A6 A7 3to8BinaryDecoder D0 D1 D2 D3 OE A0 x8 A1 x8 4to16BinaryDecoder
Embed your circuit
Ctrl+Click(Mac:command+Click) on your circuit and copy a circuit data.
Then paste it into template below.
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script type="text/javascript" src="simcir.js"></script>
<link rel="stylesheet" type="text/css" href="simcir.css" />
<script type="text/javascript" src="simcir-basicset.js"></script>
<link rel="stylesheet" type="text/css" href="simcir-basicset.css" />
<script type="text/javascript" src="simcir-library.js"></script>
<title></title>
</head>
<body>
<div class="simcir">
<!-- paste here your circuit data -->
</div>
</body>
</html>
Reuse your circuit
To reuse your circuit as library, use device 'In' and 'Out'.
In Out DC PushOff PushOn Toggle NAND DC PushOff PushOff ~S ~R NAND NAND Q ~Q
Then register it in JavaScript and add to the toolbox in HTML.
simcir.registerDevice('MyDevice ',
// paste here your circuit data
);
<div class="simcir">
⋮
"toolbox":[
{"type":"DC"},
{"type":"PushOff"},
⋮
{"type":"MyDevice "}
],
⋮
</div>
In this case, a new device 'RS-FF' is added.
Try to Double-Click the 'RS-FF' :)
Remember that all the connectors on
an input of 'In' and an output of 'Out'
are disconnected internally when the device is reused.
DC PushOff ~S ~R Q ~Q RS-FF DC PushOff PushOff ~S ~R Q ~Q RS-FF
To customize the layout of library,
add the "layout" property to your device with a text editor.
"rows" and "cols" define the size.
nodes property contains 'label - position' pairs of nodes.
simcir.registerDevice('AltFullAdder',
{
⋮
"layout":{"rows":8,"cols":8,"hideLabelOnWorkspace":true,
"nodes":{"A":"T2","B":"T6","S":"B4","Cin":"R4","Cout":"L4"}},
"devices":[
⋮
L1
L0
L2
L3
L4
T0
T1
T2
T3
T4
R0
R1
R2
R3
R4
B0
B1
B2
B3
B4
Left
Right
Bottom
Top
rows
cols
Customize a device
label, color, number of inputs, freq ...
DC Toggle LED(G) NAND(3in) OSC(1Hz) 7seg NAND(3in) Toggle Toggle Toggle DC LED(G) OSC(1Hz) NAND(3in) 7seg
LED Params
Name Type Default Description type string - "LED" label string same with type label for a device. color string #ff0000 color in hexadecimal. bgColor string #000000 background color in hexadecimal.
Code
{"type":"LED","color":"#ff0000"}
AND Params
Name Type Default Description type string - "AND" label string same with type label for a device. numInputs number 2 number of inputs.
Code
{"type":"AND","numInputs":2}
NAND Params
Name Type Default Description type string - "NAND" label string same with type label for a device. numInputs number 2 number of inputs.
Code
{"type":"NAND","numInputs":2}
OR Params
Name Type Default Description type string - "OR" label string same with type label for a device. numInputs number 2 number of inputs.
Code
{"type":"OR","numInputs":2}
NOR Params
Name Type Default Description type string - "NOR" label string same with type label for a device. numInputs number 2 number of inputs.
Code
{"type":"NOR","numInputs":2}
XOR Params
Name Type Default Description type string - "XOR" label string same with type label for a device. numInputs number 2 number of inputs.
Code
{"type":"XOR","numInputs":2}
XNOR Params
Name Type Default Description type string - "XNOR" label string same with type label for a device. numInputs number 2 number of inputs.
Code
{"type":"XNOR","numInputs":2}
OSC Params
Name Type Default Description type string - "OSC" label string same with type label for a device. freq number 10 frequency of an oscillator.
Code
{"type":"OSC","freq":10}
7seg Params
Name Type Default Description type string - "7seg" label string same with type label for a device. color string #ff0000 color in hexadecimal. bgColor string #000000 background color in hexadecimal.
Code
{"type":"7seg","color":"#ff0000"}
16seg Params
Name Type Default Description type string - "16seg" label string same with type label for a device. color string #ff0000 color in hexadecimal. bgColor string #000000 background color in hexadecimal.
Code
{"type":"16seg","color":"#ff0000"}
4bit7seg Params
Name Type Default Description type string - "4bit7seg" label string same with type label for a device. color string #ff0000 color in hexadecimal. bgColor string #000000 background color in hexadecimal.
Code
{"type":"4bit7seg","color":"#ff0000"}
RotaryEncoder Params
Name Type Default Description type string - "RotaryEncoder" label string same with type label for a device. numOutputs number 4 number of outputs.
Code
{"type":"RotaryEncoder","numOutputs":4}
x8 BusIn Params
Name Type Default Description type string - "BusIn" label string same with type label for a device. numOutputs number 8 number of outputs.
Code
{"type":"BusIn","numOutputs":8}
x8 BusOut Params
Name Type Default Description type string - "BusOut" label string same with type label for a device. numInputs number 8 number of inputs.
Code
{"type":"BusOut","numInputs":8}
Contents Copyright © Kazuhiko Arase