ruby_abc 0.0.3 → 0.0.4
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 +67 -28
- data/Rakefile +23 -19
- data/bin/{rubyabc_synthesis → ruby_abc} +2 -2
- data/ext/extconf.rb +4 -4
- data/lib/ruby_abc.rb +1 -1
- data/test/test_ruby_abc.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53a8e79cf40c11f4fb22f3d5a1e55763de58a763
|
4
|
+
data.tar.gz: 353361f5895d90f4acb08db4b5234e1a3fc0b553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69d80d3aa276f0dc302a6e750bad0751a8f8b04426846d6f1763a58061aa5e67a66a07b2d09d86268766497fd85bcedff9f49cb688ab92bd9ede790b1254bc9b
|
7
|
+
data.tar.gz: f1f182e8071c7f8a526b0d7cc93491cb0945a9ae6b87eceb4992bbb788033f40bd3e98febbd2f599c9aebea291f4fbe2b7f707b3fa25eed449332c81c8272548
|
data/README.md
CHANGED
@@ -6,39 +6,29 @@ ruby\_abc ruby C extension
|
|
6
6
|
|
7
7
|
*abc* is a system for sequential synthesis and verification,
|
8
8
|
developped at the University of California, Berkeley.
|
9
|
-
|
9
|
+
*abc* documentation can be found on its website:
|
10
10
|
[http://people.eecs.berkeley.edu/~alanmi/abc/](https://people.eecs.berkeley.edu/~alanmi/abc/)
|
11
11
|
|
12
12
|
The source code of *abc* is included in this gem,
|
13
13
|
it was cloned on 2017/11/22 from :
|
14
14
|
[https://bitbucket.org/alanmi/abc](https://bitbucket.org/alanmi/abc)
|
15
|
-
It is under MIT license.
|
16
15
|
|
17
16
|
|
18
17
|
Goal
|
19
18
|
----
|
20
19
|
|
21
|
-
The *abc* program is a command line interface: the user
|
22
|
-
|
23
|
-
such as the number of nodes or its logic level. The command adjustment can then be done in ruby instead of manually.
|
20
|
+
The *abc* program is a command line interface: the user issues commands and adjust them according to the results he gets back.
|
21
|
+
For example, the user can iterrate through minimization commands, and stops when the number of nodes of the logic network stops decreasing.
|
24
22
|
|
23
|
+
To automate this process, it is possible to give *abc* a predefined sequence of commands.
|
24
|
+
In this case, however, the number of minimization command can be too short, and the resulting network will be bigger than it could be.
|
25
|
+
The number of minimization command can also be too big, and the process will take more time than needed to execute.
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
$ gem install ruby_abc
|
31
|
-
```
|
32
|
-
|
33
|
-
This will build *abc* and the ruby\_abc extension, test and install it.
|
34
|
-
Building *abc* may be quite long.
|
27
|
+
In order to solve this process, *ruby_abc* allows to retreive some information on the current logic network in ruby,
|
28
|
+
such as the number of nodes or its logic level, to allow automation.
|
29
|
+
In the example of the minimization of a logic network, minimization commands are sent to *abc* in a ruby loop which breaks
|
30
|
+
when the number of nodes stops decreasing.
|
35
31
|
|
36
|
-
To build the gem, you will need the ruby developpement headers.
|
37
|
-
On Debian:
|
38
|
-
|
39
|
-
```lang-none
|
40
|
-
$ sudo apt-get install ruby-dev
|
41
|
-
```
|
42
32
|
|
43
33
|
Example
|
44
34
|
-------
|
@@ -53,16 +43,16 @@ ABC.read 'test/generic_netlist.blif'
|
|
53
43
|
ABC.print_stats
|
54
44
|
puts ABC.nb_nodes
|
55
45
|
|
56
|
-
## Minimize
|
57
|
-
ABC.optimize
|
46
|
+
## Minimize the network ##
|
47
|
+
ABC.optimize # itera through minimization commands and stops when the number of nodes reach a plateau
|
58
48
|
|
59
49
|
## Retime the network ##
|
60
50
|
ABC.retime
|
61
51
|
|
62
|
-
## Map the network to 4-intpu LUTs ##
|
52
|
+
## Map the network to 4-intpu LUTs (break the network in logic functions not exceeding 4 inputs) ##
|
63
53
|
n_nodes = ABC.nb_nodes
|
64
54
|
loop do
|
65
|
-
ABC.run_command 'choice; if -K 4
|
55
|
+
ABC.run_command 'choice; if -K 4; ps'
|
66
56
|
break if ABC.nb_nodes == n_nodes
|
67
57
|
n_nodes = ABC.nb_nodes
|
68
58
|
end
|
@@ -73,23 +63,72 @@ ABC.map 4
|
|
73
63
|
ABC.write 'mapped_netlist.blif'
|
74
64
|
```
|
75
65
|
|
66
|
+
Installation
|
67
|
+
------------
|
68
|
+
|
69
|
+
To install *ruby_abc* from the git repository:
|
70
|
+
|
71
|
+
```lang-none
|
72
|
+
$ git clone https://github.com/TheotimeBollengier/ruby_abc
|
73
|
+
$ cd ruby_abc
|
74
|
+
$ gem build ruby_abc.gemspec
|
75
|
+
$ gem install ruby_abc.<version>.gem
|
76
|
+
```
|
77
|
+
|
78
|
+
Alternatively, *ruby_abc* gem is also hosted on RubyGems ([https://rubygems.org/gems/ruby_abc](https://rubygems.org/gems/ruby_abc)).
|
79
|
+
So you can simply type:
|
80
|
+
|
81
|
+
```lang-none
|
82
|
+
$ gem install ruby_abc
|
83
|
+
```
|
84
|
+
|
85
|
+
This will build *abc* and the *ruby_abc* extension, and install it.
|
86
|
+
Building *abc* may take quite some time.
|
87
|
+
|
88
|
+
As this gem includes a C extension, building it requires the ruby developpement headers.
|
89
|
+
On Debian, you can get them with:
|
90
|
+
|
91
|
+
```lang-none
|
92
|
+
$ sudo apt-get install ruby-dev
|
93
|
+
```
|
94
|
+
|
95
|
+
|
76
96
|
Executable
|
77
97
|
----------
|
78
98
|
|
79
|
-
|
80
|
-
|
99
|
+
To use *ruby_abc* directly from a terminal or a Makefile,
|
100
|
+
this gem also include the `ruby_abc` executable script, which uses command line arguments.
|
81
101
|
|
82
102
|
```lang-none
|
83
|
-
$
|
103
|
+
$ ruby_abc --help
|
84
104
|
Usage: rubyabc_synthesis [options] -i <input_file> -o <output_file>
|
85
105
|
-i, --input FILE Input BLIF file
|
86
106
|
-o, --output FILE Output netlist to FILE
|
87
107
|
-r, --retime Retime netlist
|
88
108
|
-z, --zero Set latches initial value to zero
|
89
109
|
-l, --lcorr Computes latch correspondence using 1-step induction
|
90
|
-
-a, --area Optimize
|
110
|
+
-a, --area Optimize for area instead of performance (minimize the number of nodes instead of the logic level)
|
91
111
|
-w, --sweep Sweep logic network to remove dangling nodes
|
92
112
|
-k, --lut_inputs K Map to K-input LUTs.
|
93
113
|
-h, --help Display this help
|
94
114
|
```
|
95
115
|
|
116
|
+
The *abc* executable is also included so that it can be used natively without ruby.
|
117
|
+
|
118
|
+
|
119
|
+
Documentation
|
120
|
+
-------------
|
121
|
+
|
122
|
+
Html documentation for *ruby_abc* can be generated with `rake doc`.
|
123
|
+
This documentation covers only the API of *ruby_abc*, not *abc* itself.
|
124
|
+
*abc* documentation can be found on [http://people.eecs.berkeley.edu/~alanmi/abc/](https://people.eecs.berkeley.edu/~alanmi/abc/).
|
125
|
+
Also, available *abc* commands can be retreived with `ABC.help` (in ruby),
|
126
|
+
and specific command documentation can be seen with `ABC.run_command('<command_name> -h')` (in ruby).
|
127
|
+
|
128
|
+
|
129
|
+
Test
|
130
|
+
----
|
131
|
+
|
132
|
+
`$ rake test` will execute `test/test_ruby_abc.rb`.
|
133
|
+
This will read a BLIF netlist, optimize it and check the result against a golden model.
|
134
|
+
|
data/Rakefile
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'mkmf'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
root_path = File.dirname(File.expand_path(__FILE__))
|
5
|
-
ext_path =
|
6
|
-
test_path =
|
7
|
-
lib_path =
|
8
|
-
ilib_path =
|
9
|
-
abc_path =
|
6
|
+
ext_path = File.join(root_path, 'ext')
|
7
|
+
test_path = File.join(root_path, 'test')
|
8
|
+
lib_path = File.join(root_path, 'lib')
|
9
|
+
ilib_path = File.join(lib_path, 'ruby_abc')
|
10
|
+
abc_path = File.join(ext_path, 'abc')
|
10
11
|
|
11
12
|
|
12
|
-
rubyabcext =
|
13
|
+
rubyabcext = File.join(ilib_path, 'ruby_abc.so')
|
13
14
|
rubyabcsrc = Rake::FileList["#{ext_path}/*.c", "#{ext_path}/*.h"]
|
14
15
|
abcsrc = Rake::FileList["#{abc_path}/**/*.c", "#{abc_path}/**/*.h"]
|
15
|
-
libabc =
|
16
|
+
libabc = File.join(abc_path, 'libabc.so')
|
16
17
|
docsrcfiles = Rake::FileList["#{ext_path}/*.c", "#{ext_path}/*.h", "lib/ruby_abc.rb", "README.md"]
|
17
18
|
|
18
19
|
|
19
|
-
desc 'build gem
|
20
|
-
task :default =>
|
20
|
+
desc 'build the gem'
|
21
|
+
task :default => :compile
|
21
22
|
|
22
23
|
desc 'build extension'
|
23
24
|
task :compile => rubyabcext
|
@@ -29,11 +30,11 @@ task rubyabcext => ([libabc] + rubyabcsrc) do
|
|
29
30
|
sh "ruby extconf.rb"
|
30
31
|
sh "make"
|
31
32
|
Dir.chdir wd
|
32
|
-
sh "mkdir -p #{ilib_path}"
|
33
|
-
sh "cp #{ext_path
|
33
|
+
sh "mkdir -p '#{ilib_path}'"
|
34
|
+
sh "cp '#{File.join(ext_path, 'ruby_abc.so')}' '#{rubyabcext}'"
|
34
35
|
end
|
35
36
|
|
36
|
-
desc 'compile abc'
|
37
|
+
desc 'compile libabc.so and abc'
|
37
38
|
task libabc => abcsrc do
|
38
39
|
abort "Library libpthread was not found" if !have_library('pthread')
|
39
40
|
abort "Library libdl was not found" if !have_library('dl')
|
@@ -41,22 +42,24 @@ task libabc => abcsrc do
|
|
41
42
|
wd = Dir.getwd
|
42
43
|
Dir.chdir(abc_path)
|
43
44
|
sh "make -j4 ABC_USE_PIC=true OPTFLAGS='-O2' ABC_USE_NO_READLINE=true libabc.so"
|
45
|
+
sh "make ABC_USE_PIC=true OPTFLAGS='-O2' ABC_USE_NO_READLINE=true abc"
|
44
46
|
Dir.chdir(wd)
|
47
|
+
FileUtils.move(File.join(abc_path, 'abc'), File.join(root_path, 'bin', 'abc'), force: true)
|
45
48
|
end
|
46
49
|
|
47
50
|
desc 'Test ruby_abc'
|
48
51
|
task :test => rubyabcext do
|
49
|
-
sh "ruby '#{test_path
|
52
|
+
sh "ruby '#{File.join(test_path, 'test_ruby_abc.rb')}'"
|
50
53
|
end
|
51
54
|
|
52
55
|
desc 'Generate html documentation'
|
53
56
|
task :doc do
|
54
|
-
sh "rdoc --main=README.md --title='ruby_abc ruby extension' --output='#{root_path
|
57
|
+
sh "rdoc --main=README.md --title='ruby_abc ruby extension' --output='#{File.join(root_path, 'doc')}' #{docsrcfiles}"
|
55
58
|
end
|
56
59
|
|
57
60
|
desc 'Cleanup build files'
|
58
61
|
task :clean do
|
59
|
-
extmakefile =
|
62
|
+
extmakefile = File.join(ext_path, 'Makefile')
|
60
63
|
if File.exist? extmakefile
|
61
64
|
wd = Dir.getwd
|
62
65
|
Dir.chdir ext_path
|
@@ -64,7 +67,7 @@ task :clean do
|
|
64
67
|
Dir.chdir wd
|
65
68
|
end
|
66
69
|
|
67
|
-
abcmakefile =
|
70
|
+
abcmakefile = File.join(abc_path, 'Makefile')
|
68
71
|
if File.exist? abcmakefile
|
69
72
|
wd = Dir.getwd
|
70
73
|
Dir.chdir abc_path
|
@@ -72,12 +75,13 @@ task :clean do
|
|
72
75
|
Dir.chdir wd
|
73
76
|
end
|
74
77
|
|
75
|
-
sh "rm -rvf '#{root_path
|
78
|
+
sh "rm -rvf '#{File.join(root_path, 'doc')}'"
|
76
79
|
end
|
77
80
|
|
78
81
|
desc 'Cleanup everyting'
|
79
82
|
task :mrproper => :clean do
|
80
|
-
sh "rm -vf '#{ext_path
|
81
|
-
sh "rm -rvf '#{ilib_path}
|
83
|
+
sh "rm -vf '#{File.join(ext_path, 'Makefile')}'"
|
84
|
+
sh "rm -rvf '#{ilib_path}'"
|
85
|
+
sh "rm -vf '#{File.join(root_path, 'bin', 'abc')}'"
|
82
86
|
end
|
83
87
|
|
@@ -9,12 +9,12 @@ optparse = OptionParser.new do |opts|
|
|
9
9
|
opts.banner = "Usage: #{File.basename(__FILE__)} [options] -i <input_file> -o <output_file>"
|
10
10
|
|
11
11
|
options[:inputFileName] = nil
|
12
|
-
opts.on('-i', '--input FILE', 'Input
|
12
|
+
opts.on('-i', '--input FILE', 'Input file name') do |file|
|
13
13
|
options[:inputFileName] = file
|
14
14
|
end
|
15
15
|
|
16
16
|
options[:outputFileName] = nil
|
17
|
-
opts.on('-o', '--output FILE', 'Output
|
17
|
+
opts.on('-o', '--output FILE', 'Output file name') do |file|
|
18
18
|
options[:outputFileName] = file
|
19
19
|
end
|
20
20
|
|
data/ext/extconf.rb
CHANGED
@@ -4,11 +4,11 @@ require 'mkmf'
|
|
4
4
|
|
5
5
|
extension_name = 'ruby_abc'
|
6
6
|
|
7
|
-
abc_path = File.dirname(File.expand_path(__FILE__))
|
7
|
+
abc_path = File.join(File.dirname(File.expand_path(__FILE__)), 'abc')
|
8
8
|
|
9
|
-
$CFLAGS += " -I #{abc_path}
|
10
|
-
$CFLAGS += ' ' + `#{abc_path}
|
11
|
-
$LOCAL_LIBS +=
|
9
|
+
$CFLAGS += " -I #{File.join(abc_path, 'src')}"
|
10
|
+
$CFLAGS += ' ' + `#{File.join(abc_path, 'arch_flags')}`
|
11
|
+
$LOCAL_LIBS += ' ' + File.join(abc_path, 'libabc.so')
|
12
12
|
|
13
13
|
create_makefile(extension_name)
|
14
14
|
|
data/lib/ruby_abc.rb
CHANGED
data/test/test_ruby_abc.rb
CHANGED
@@ -14,7 +14,7 @@ golden_mapped_nb_nodes = 80
|
|
14
14
|
golden_mapped_nb_latches = 45
|
15
15
|
golden_mapped_nb_levels = 6
|
16
16
|
|
17
|
-
netlist_filename =
|
17
|
+
netlist_filename = File.join(File.dirname(File.expand_path(__FILE__)), 'generic_netlist.blif')
|
18
18
|
|
19
19
|
ABC.echo_commands = false
|
20
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_abc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Théotime Bollengier
|
@@ -17,7 +17,7 @@ description: |-
|
|
17
17
|
email:
|
18
18
|
- theotime.bollengier@gmail.com
|
19
19
|
executables:
|
20
|
-
-
|
20
|
+
- ruby_abc
|
21
21
|
extensions:
|
22
22
|
- Rakefile
|
23
23
|
extra_rdoc_files: []
|
@@ -25,7 +25,7 @@ files:
|
|
25
25
|
- LICENSE
|
26
26
|
- README.md
|
27
27
|
- Rakefile
|
28
|
-
- bin/
|
28
|
+
- bin/ruby_abc
|
29
29
|
- ext/abc/CMakeLists.txt
|
30
30
|
- ext/abc/Makefile
|
31
31
|
- ext/abc/abc.rc
|