bliftax 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/bliftax/implicant.rb +28 -11
- data/lib/bliftax/version.rb +1 -1
- data/lib/bliftax.rb +17 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3684c7584ac8b0997cf6de140dadf03327bea675
|
4
|
+
data.tar.gz: 75bcb8953ee6979a0536f557326b7df0987eaa76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4bd813c5b38f9ee2328f0e0bae284971a9ef88c1fe32d19a16c4d29644af8ce8287c576a3fa3e1a667f3f7c46d5ed544f2f7d64a1e934be520eb4dd6e93d2c9
|
7
|
+
data.tar.gz: 581ec378e22f33b2e0bcaf804f9c3823d0d523094def03fd90f9c9872753ede88487cc45c0c7773a0d98080c433167636f6cfe8bcb813402784eafc4730bcd4c
|
data/README.md
CHANGED
@@ -11,8 +11,7 @@ partially naming this gem.
|
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
14
|
-
$
|
15
|
-
$ rake install
|
14
|
+
$ gem install bliftax
|
16
15
|
|
17
16
|
## Usage
|
18
17
|
|
@@ -25,6 +24,7 @@ This gem currently only supports the following declarations for BLIF:
|
|
25
24
|
.names
|
26
25
|
.latch
|
27
26
|
.clock
|
27
|
+
.end
|
28
28
|
```
|
29
29
|
|
30
30
|
Following is the list of main features of this gem:
|
data/lib/bliftax/implicant.rb
CHANGED
@@ -4,18 +4,20 @@ require 'bliftax/implicant/bit'
|
|
4
4
|
class Bliftax
|
5
5
|
# A class that represents an implicant of a gate.
|
6
6
|
class Implicant
|
7
|
-
# Look-up tables for the star
|
8
|
-
# +---+---+---+---+
|
9
|
-
# |A/B| 0 | 1 | - |
|
10
|
-
# +---+---+---+---+
|
11
|
-
# | 0 | | | |
|
12
|
-
# +---+---+---+---+
|
13
|
-
# | 1 | | | |
|
14
|
-
# +---+---+---+---+
|
15
|
-
# | - | | | |
|
16
|
-
# +---+---+---+---+
|
7
|
+
# Look-up tables for the star operator.
|
17
8
|
#
|
18
|
-
#
|
9
|
+
# @example
|
10
|
+
# +---+---+---+---+
|
11
|
+
# |A/B| 0 | 1 | - |
|
12
|
+
# +---+---+---+---+
|
13
|
+
# | 0 | 0 | N | 0 |
|
14
|
+
# +---+---+---+---+
|
15
|
+
# | 1 | N | 1 | 1 |
|
16
|
+
# +---+---+---+---+
|
17
|
+
# | - | 0 | 1 | - |
|
18
|
+
# +---+---+---+---+
|
19
|
+
#
|
20
|
+
# bit_result = STAR_TABLE[a.bit][b.bit]
|
19
21
|
STAR_TABLE = {
|
20
22
|
Bit::OFF => {
|
21
23
|
Bit::OFF => Bit::OFF,
|
@@ -33,6 +35,21 @@ class Bliftax
|
|
33
35
|
Bit::DC => Bit::DC
|
34
36
|
}
|
35
37
|
}
|
38
|
+
|
39
|
+
# Look-up tables for the sharp operator.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# +---+---+---+---+
|
43
|
+
# |A/B| 0 | 1 | - |
|
44
|
+
# +---+---+---+---+
|
45
|
+
# | 0 | E | N | E |
|
46
|
+
# +---+---+---+---+
|
47
|
+
# | 1 | N | E | E |
|
48
|
+
# +---+---+---+---+
|
49
|
+
# | - | 1 | 0 | E |
|
50
|
+
# +---+---+---+---+
|
51
|
+
#
|
52
|
+
# bit_result = SHARP_TABLE[a.bit][b.bit]
|
36
53
|
SHARP_TABLE = {
|
37
54
|
Bit::OFF => {
|
38
55
|
Bit::OFF => Bit::EPSILON,
|
data/lib/bliftax/version.rb
CHANGED
data/lib/bliftax.rb
CHANGED
@@ -6,18 +6,17 @@ require 'bliftax/version'
|
|
6
6
|
class Bliftax
|
7
7
|
attr_accessor :name, :inputs, :outputs, :latches, :clocks, :gates
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# One space
|
9
|
+
DECL_MODEL = '.model'
|
10
|
+
DECL_INPUTS = '.inputs'
|
11
|
+
DECL_OUTPUTS = '.outputs'
|
12
|
+
DECL_NAMES = '.names'
|
13
|
+
DECL_LATCH = '.latch'
|
14
|
+
DECL_CLOCK = '.clock'
|
15
|
+
DECL_END = '.end'
|
16
|
+
|
17
|
+
# One space for readability.
|
19
18
|
SPACE = ' '
|
20
|
-
# Empty string
|
19
|
+
# Empty string for readability.
|
21
20
|
EMPTY = ''
|
22
21
|
|
23
22
|
# Initializes the object.
|
@@ -44,19 +43,19 @@ class Bliftax
|
|
44
43
|
(decl, *following) = line.split(SPACE)
|
45
44
|
|
46
45
|
case decl
|
47
|
-
when
|
46
|
+
when DECL_MODEL
|
48
47
|
@name = following.first
|
49
|
-
when
|
48
|
+
when DECL_INPUTS
|
50
49
|
@inputs = following
|
51
|
-
when
|
50
|
+
when DECL_OUTPUTS
|
52
51
|
@outputs = following
|
53
|
-
when
|
52
|
+
when DECL_NAMES
|
54
53
|
@gates << parse_gate(following, lines, i + 1)
|
55
|
-
when
|
54
|
+
when DECL_LATCH
|
56
55
|
@latches << following
|
57
|
-
when
|
56
|
+
when DECL_CLOCK
|
58
57
|
@clocks << following
|
59
|
-
when
|
58
|
+
when DECL_END
|
60
59
|
break
|
61
60
|
when /^[^\.]/
|
62
61
|
next
|