Skip to content

Commit

Permalink
Make comparators only output one bit-wide signals
Browse files Browse the repository at this point in the history
  • Loading branch information
prescientmoon committed Nov 27, 2024
1 parent 27c6ce1 commit 7d9d2a2
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/modules/saving/templates/comparator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ import { categories } from '../data/categories'
* The template of the comparator gate
*/
const comparatorTemplate: PartialTemplate = {
metadata: {
name: 'comparator'
},
info: ['https://www.technobyte.org/comparator/'],
category: categories.math,
code: {
activation: `
const a = context.getBinary(0)
const b = context.getBinary(1)
metadata: {
name: 'comparator'
},
info: ['https://www.technobyte.org/comparator/'],
category: categories.math,
code: {
activation: `
const a = context.getBinary(0)
const b = context.getBinary(1)
context.setBinary(0, Number(a > b))
context.setBinary(1, Number(a === b))
context.setBinary(2, Number(a < b))
`
},
pins: {
inputs: {
count: 2
},
outputs: {
count: 3
}
},
material: {
type: 'image',
fill: require('../../../assets/comparator.svg')
context.setBinary(0, Number(a > b), 1)
context.setBinary(1, Number(a === b), 1)
context.setBinary(2, Number(a < b), 1)
`
},
pins: {
inputs: {
count: 2
},
shape: {
scale: [125, 125]
outputs: {
count: 3
}
},
material: {
type: 'image',
fill: require('../../../assets/comparator.svg')
},
shape: {
scale: [125, 125]
}
}

export default comparatorTemplate

0 comments on commit 7d9d2a2

Please sign in to comment.