bliftax 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 629ed1deeccb6405f838c9867ca6a1f83872c2d6
4
- data.tar.gz: f6d15136e5044fbf828e0ebf143dc43b7c8247e5
3
+ metadata.gz: 3684c7584ac8b0997cf6de140dadf03327bea675
4
+ data.tar.gz: 75bcb8953ee6979a0536f557326b7df0987eaa76
5
5
  SHA512:
6
- metadata.gz: 26642f82d331d02108f63e891805f80066addea67c88f726f5b21ef67a544feebc72b77ecdcff557dc9efe6ea2b270abb3de6f863b433ca8936200f4e7a97607
7
- data.tar.gz: 7e93b46f18ec3a43880f9eb001726de378d8adfcc2cf0c5594510b7636f524ed4c8a92e71d6dc022f9d5a3bae3756a6436f464eb342f118c8fb34ab6e9b4897c
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
- $ bundle install
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:
@@ -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 and sharp operators
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
- # Use it like: STAR_TABLE[a.bit][b.bit]
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,
@@ -1,3 +1,3 @@
1
1
  class Bliftax
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
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
- # Declarations for BLIF
10
- MODEL = '.model'
11
- INPUTS = '.inputs'
12
- OUTPUTS = '.outputs'
13
- NAMES = '.names'
14
- LATCH = '.latch'
15
- CLOCK = '.clock'
16
- END_MODEL = '.end'
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 MODEL
46
+ when DECL_MODEL
48
47
  @name = following.first
49
- when INPUTS
48
+ when DECL_INPUTS
50
49
  @inputs = following
51
- when OUTPUTS
50
+ when DECL_OUTPUTS
52
51
  @outputs = following
53
- when NAMES
52
+ when DECL_NAMES
54
53
  @gates << parse_gate(following, lines, i + 1)
55
- when LATCH
54
+ when DECL_LATCH
56
55
  @latches << following
57
- when CLOCK
56
+ when DECL_CLOCK
58
57
  @clocks << following
59
- when END_MODEL
58
+ when DECL_END
60
59
  break
61
60
  when /^[^\.]/
62
61
  next
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bliftax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoki Mizuno