cpu-simulator/build/editor/js/bk/chips.js

188 lines
4.3 KiB
JavaScript
Executable File

chips = {
"nand": {
image: "img/gates/nand.png",
inputs: 2,
pins : [0,0,0],
subComponents : [],
wires : []
},
"not": {
image: "img/gates/not.png",
inputs: 1,
pins: [0,0],
subComponents: ["nand"],
wires: [
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 0 }
},
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 1 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 0, pin: 1 }
}
]
},
"and": {
image: "img/gates/and.png",
inputs: 2,
pins : [0,0,0],
subComponents : ["nand", "nand"],
wires : [
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 0 },
},
{
source: { component: 0, pin: 1 },
destination: { component: 1, pin: 1 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 2, pin: 0 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 2, pin: 1 }
},
{
source: { component: 2, pin: 2 },
destination: { component: 0, pin: 2 }
}
]
},
"or": {
image: "img/gates/or.png",
inputs: 2,
pins: [0,0,0],
subComponents : ["nand","nand","nand"],
wires : [
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 0 },
},
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 1 }
},
{
source: { component: 0, pin: 1 },
destination: { component: 2, pin: 0 }
},
{
source: { component: 0, pin: 1 },
destination: { component: 2, pin: 1 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 3, pin: 0 }
},
{
source: { component: 2, pin: 2 },
destination: { component: 3, pin: 1 }
},
{
source: { component: 3, pin: 2 },
destination: { component: 0, pin: 2 }
}
]
},
"xor": {
image: "img/gates/xor.png",
inputs:2,
pins: [0,0,0],
subComponents: ["nand","nand","nand", "nand"],
wires : [
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 0 }
},
{
source: { component: 0, pin: 1 },
destination: { component: 1, pin: 1 }
},
{
source: { component: 0, pin: 0 },
destination: { component: 2, pin: 0 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 2, pin: 1 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 3, pin: 0 }
},
{
source: { component: 0, pin: 1 },
destination: { component: 3, pin: 1 }
},
{
source: { component: 2, pin: 2 },
destination: { component: 4, pin: 0 }
},
{
source: { component: 3, pin: 2 },
destination: { component: 4, pin: 1 }
},
{
source: { component: 4, pin: 2 },
destination: { component: 0, pin: 2 }
}
]
},
"nor": {
inputs:2,
image: "img/gates/nor.png",
pins: [0,0,0],
subComponents: ["or","not"],
wires: [
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 0 }
},
{
source: { component: 0, pin: 1 },
destination: { component: 1, pin: 1 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 2, pin: 0 },
},
{
source: { component: 2, pin: 1 },
destination: { component: 0, pin: 2 }
}
]
},
"xnor": {
image: "img/gates/nor.png",
pins: [0,0,0],
subComponents: ["xor","not"],
wires: [
{
source: { component: 0, pin: 0 },
destination: { component: 1, pin: 0 }
},
{
source: { component: 0, pin: 1 },
destination: { component: 1, pin: 1 }
},
{
source: { component: 1, pin: 2 },
destination: { component: 2, pin: 0 },
},
{
source: { component: 2, pin: 1 },
destination: { component: 0, pin: 2 }
}
]
}
}