-
Notifications
You must be signed in to change notification settings - Fork 11
/
DRegister.js
42 lines (29 loc) · 908 Bytes
/
DRegister.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* The MIT License (MIT)
* Copyright (c) 2017-present Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
*/
'use strict';
const colors = require('colors');
const Register = require('./Register');
/**
* 16-bit D (Data) register.
*/
class DRegister extends Register {}
/**
* Specification of the `DRegister` gate.
*/
DRegister.Spec = {
name: 'DRegister',
description: `16-bit D (Data) register.
If load[t]=1 then out[t+1] = in[t] else out does not change.
Clock rising edge updates the value from the input,
if the \`load\` is set; otherwise, preserves the state.
${colors.bold('↗')} : value = load ? in : value
Clock falling edge propagates the value to the output:
${colors.bold('↘')} : out = value
`,
inputPins: [{name: 'in', size: 16}, {name: 'load', size: 1}],
outputPins: [{name: 'out', size: 16}],
truthTable: Register.Spec.truthTable,
};
module.exports = DRegister;