| 409 | } |
| 410 | |
| 411 | func (g *Compare2) Update(inputA, inputB, equalIn, isLargerIn bool) { |
| 412 | g.inputA.Update(inputA) |
| 413 | g.inputB.Update(inputB) |
| 414 | g.equalIn.Update(equalIn) |
| 415 | g.isLargerIn.Update(isLargerIn) |
| 416 | |
| 417 | g.xor1.Update(g.inputA.Get(), g.inputB.Get()) |
| 418 | g.not1.Update(g.xor1.Output()) |
| 419 | g.and1.Update(g.not1.Output(), g.equalIn.Get()) |
| 420 | g.equalOut.Update(g.and1.Output()) |
| 421 | |
| 422 | g.andgate3.Update(g.equalIn.Get(), g.inputA.Get(), g.xor1.Output()) |
| 423 | g.or1.Update(g.andgate3.Output(), g.isLargerIn.Get()) |
| 424 | g.isLargerOut.Update(g.or1.Output()) |
| 425 | |
| 426 | g.out.Update(g.xor1.Output()) |
| 427 | } |
| 428 | |
| 429 | type Comparator struct { |
| 430 | inputs [arch.BUS_WIDTH * 2]circuit.Wire |