Make comparators only output one bit-wide signals
This commit is contained in:
parent
27c6ce13c9
commit
7d9d2a2d78
|
@ -5,36 +5,36 @@ import { categories } from '../data/categories'
|
||||||
* The template of the comparator gate
|
* The template of the comparator gate
|
||||||
*/
|
*/
|
||||||
const comparatorTemplate: PartialTemplate = {
|
const comparatorTemplate: PartialTemplate = {
|
||||||
metadata: {
|
metadata: {
|
||||||
name: 'comparator'
|
name: 'comparator'
|
||||||
},
|
},
|
||||||
info: ['https://www.technobyte.org/comparator/'],
|
info: ['https://www.technobyte.org/comparator/'],
|
||||||
category: categories.math,
|
category: categories.math,
|
||||||
code: {
|
code: {
|
||||||
activation: `
|
activation: `
|
||||||
const a = context.getBinary(0)
|
const a = context.getBinary(0)
|
||||||
const b = context.getBinary(1)
|
const b = context.getBinary(1)
|
||||||
|
|
||||||
context.setBinary(0, Number(a > b))
|
context.setBinary(0, Number(a > b), 1)
|
||||||
context.setBinary(1, Number(a === b))
|
context.setBinary(1, Number(a === b), 1)
|
||||||
context.setBinary(2, Number(a < b))
|
context.setBinary(2, Number(a < b), 1)
|
||||||
`
|
`
|
||||||
|
},
|
||||||
|
pins: {
|
||||||
|
inputs: {
|
||||||
|
count: 2
|
||||||
},
|
},
|
||||||
pins: {
|
outputs: {
|
||||||
inputs: {
|
count: 3
|
||||||
count: 2
|
|
||||||
},
|
|
||||||
outputs: {
|
|
||||||
count: 3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
material: {
|
|
||||||
type: 'image',
|
|
||||||
fill: require('../../../assets/comparator.svg')
|
|
||||||
},
|
|
||||||
shape: {
|
|
||||||
scale: [125, 125]
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
material: {
|
||||||
|
type: 'image',
|
||||||
|
fill: require('../../../assets/comparator.svg')
|
||||||
|
},
|
||||||
|
shape: {
|
||||||
|
scale: [125, 125]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default comparatorTemplate
|
export default comparatorTemplate
|
||||||
|
|
Loading…
Reference in a new issue