ruby_abc 0.0.1 → 0.0.2

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +94 -0
  3. data/Rakefile +55 -8
  4. data/ext/extconf.rb +13 -13
  5. data/lib/ruby_abc.rb +1 -1
  6. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d20dd0d5452bfd1b68e34f34f5603450d4cdcaa3
4
- data.tar.gz: 42886f12a96bc610f49c21c7a0de2a71bc6526e8
3
+ metadata.gz: 41e553c152e6e79972e750684a1ce6c7202d9103
4
+ data.tar.gz: 2b25effdbb6f5c8e187d81d238781758a82d8283
5
5
  SHA512:
6
- metadata.gz: b6ade39f9397bae0ba5308118e5709b8a317ae97222db0e4f5d30afe98b20050815aecfa66a4fa6cca4bf079d85c92470e3a4c9bec520c342f3c85497cefff9d
7
- data.tar.gz: 71cb05d008ba74289b702ba7eb0eb333be28f29d9db5a63e5ef312011ebaf98139ad0a5ecbed3c33b4028ff70d13d7d06c3cb80bec02d5811252e0a52d5cc0f8
6
+ metadata.gz: 88642d498b0c7a98833d7aac6a543031713fa59b314a797753b946898372892f58a5de6172305b76b9b1df7fb27b383a5e86841e5622b4a574dbcbc7fcb9f68f
7
+ data.tar.gz: 7e9c2fcea279f6b6f0666f2e3b104f6ed89a71346c9a1c26d0a050b91d845f27cf200c82fac5ef850effdcdbfbcec973b6d5357475f9c43ae25ddc58e259bfbe
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+
2
+ ruby\_abc ruby C extension
3
+ ==========================
4
+
5
+ **ruby\_abc** is a ruby C extension wrapping the Berkeley logic synthesis system *abc*.
6
+
7
+ *abc* is a system for sequential synthesis and verification,
8
+ developped at the University of California, Berkeley.
9
+ Documentation on *abc* can be found on its website:
10
+ [http://people.eecs.berkeley.edu/~alanmi/abc/](https://people.eecs.berkeley.edu/~alanmi/abc/)
11
+
12
+ The source code of *abc* is included in this gem,
13
+ it was cloned on 2017/11/22 from :
14
+ [http://people.eecs.berkeley.edu/~alanmi/abc/](http://people.eecs.berkeley.edu/~alanmi/abc/)
15
+ It is under MIT license.
16
+
17
+
18
+ Goal
19
+ ----
20
+
21
+ The *abc* program is a command line interface: the user issue commands and adjust them according to the results he gets back.
22
+ In order to automate this process, the *ruby_abc* allows to retreive some information on the current logic network in ruby,
23
+ such as the number of nodes or its logic level. The command adjustment can then be done in ruby instead of manually.
24
+
25
+ Installation
26
+ ------------
27
+
28
+ ```lang-none
29
+ $ gem install ruby_abc
30
+ ```
31
+
32
+ This will build *abc* and the ruby\_abc extension, test and install it.
33
+ Building *abc* may be quite long.
34
+
35
+ To build the gem, you will need the ruby developpement headers.
36
+ On Debian:
37
+
38
+ ```lang-none
39
+ $ sudo apt-get install ruby-dev
40
+ ```
41
+
42
+ Example
43
+ -------
44
+
45
+ ```ruby
46
+ require 'ruby_abc'
47
+
48
+ ## Load a netlist ##
49
+ ABC.read 'test/generic_netlist.blif'
50
+
51
+ ## Print informations on the logic network ##
52
+ ABC.print_stats
53
+ puts ABC.nb_nodes
54
+
55
+ ## Minimize number the of nodes of the network ##
56
+ ABC.optimize
57
+
58
+ ## Retime the network ##
59
+ ABC.retime
60
+
61
+ ## Map the network to 4-intpu LUTs ##
62
+ n_nodes = ABC.nb_nodes
63
+ loop do
64
+ ABC.run_command 'choice; if -K 4 -a; ps'
65
+ break if ABC.nb_nodes == n_nodes
66
+ n_nodes = ABC.nb_nodes
67
+ end
68
+ # is equivalent to:
69
+ ABC.map 4
70
+
71
+ ## Write the network to an output file ##
72
+ ABC.write 'mapped_netlist.blif'
73
+ ```
74
+
75
+ Executable
76
+ ----------
77
+
78
+ This gem also include the `rubyabc_synthesis` executable (a ruby script)
79
+ allowing to synthesize netlists directly from a terminal.
80
+
81
+ ```lang-none
82
+ $ rubyabc_synthesis --help
83
+ Usage: rubyabc_synthesis [options] -i <input_file> -o <output_file>
84
+ -i, --input FILE Input BLIF file
85
+ -o, --output FILE Output netlist to FILE
86
+ -r, --retime Retime netlist
87
+ -z, --zero Set latches initial value to zero
88
+ -l, --lcorr Computes latch correspondence using 1-step induction
89
+ -a, --area Optimize in area
90
+ -w, --sweep Sweep logic network to remove dangling nodes
91
+ -k, --lut_inputs K Map to K-input LUTs.
92
+ -h, --help Display this help
93
+ ```
94
+
data/Rakefile CHANGED
@@ -1,20 +1,29 @@
1
1
  require 'rake'
2
+ require 'mkmf'
2
3
 
3
4
  root_path = File.dirname(File.expand_path(__FILE__))
4
5
  ext_path = "#{root_path}/ext"
5
6
  test_path = "#{root_path}/test"
6
7
  lib_path = "#{root_path}/lib"
7
8
  ilib_path = "#{lib_path}/ruby_abc"
9
+ abc_path = "#{ext_path}/abc"
10
+
8
11
 
9
12
  rubyabcext = "#{ilib_path}/ruby_abc.so"
10
13
  rubyabcsrc = Rake::FileList["#{ext_path}/*.c", "#{ext_path}/*.h"]
14
+ abcsrc = Rake::FileList["#{abc_path}/**/*.c", "#{abc_path}/**/*.h"]
15
+ libabc = "#{abc_path}/libabc.so"
11
16
  docsrcfiles = Rake::FileList["#{ext_path}/*.c", "#{ext_path}/*.h", "lib/ruby_abc.rb", "README.md"]
12
- docfile = 'doc/index.html'
13
17
 
14
18
 
15
- task :default => [rubyabcext, :test, :doc]
19
+ desc 'build gem, test it and generate html documentaion'
20
+ task :default => [:compile, :test, :doc]
21
+
22
+ desc 'build extension'
23
+ task :compile => rubyabcext
16
24
 
17
- rule rubyabcext => rubyabcsrc do
25
+ desc 'compile extension'
26
+ task rubyabcext => ([libabc] + rubyabcsrc) do
18
27
  wd = Dir.getwd
19
28
  Dir.chdir ext_path
20
29
  sh "ruby extconf.rb"
@@ -24,13 +33,51 @@ rule rubyabcext => rubyabcsrc do
24
33
  sh "cp #{ext_path}/ruby_abc.so #{rubyabcext}"
25
34
  end
26
35
 
27
- task :test do
28
- sh "#{test_path}/test_ruby_abc.rb"
36
+ desc 'compile abc'
37
+ task libabc => abcsrc do
38
+ abort "Library libpthread was not found" if !have_library('pthread')
39
+ abort "Library libdl was not found" if !have_library('dl')
40
+ abort "Library librt was not found" if !have_library('rt')
41
+ wd = Dir.getwd
42
+ Dir.chdir(abc_path)
43
+ sh "make -j4 ABC_USE_PIC=true OPTFLAGS='-O2' ABC_USE_NO_READLINE=true libabc.so"
44
+ Dir.chdir(wd)
45
+ end
46
+
47
+ desc 'Test ruby_abc'
48
+ task :test => rubyabcext do
49
+ sh "ruby '#{test_path}/test_ruby_abc.rb'"
29
50
  end
30
51
 
31
- task :doc => docfile
52
+ desc 'Generate html documentation'
53
+ task :doc do
54
+ sh "rdoc --main '#{root_path}/README.md' --title='ruby_abc ruby extension' --output='#{root_path}/doc' #{docsrcfiles}"
55
+ end
56
+
57
+ desc 'Cleanup build files'
58
+ task :clean do
59
+ extmakefile = "#{ext_path}/Makefile"
60
+ if File.exist? extmakefile
61
+ wd = Dir.getwd
62
+ Dir.chdir ext_path
63
+ sh "make -f '#{extmakefile}' clean"
64
+ Dir.chdir wd
65
+ end
66
+
67
+ abcmakefile = "#{abc_path}/Makefile"
68
+ if File.exist? abcmakefile
69
+ wd = Dir.getwd
70
+ Dir.chdir abc_path
71
+ sh "make -f '#{abcmakefile}' clean"
72
+ Dir.chdir wd
73
+ end
74
+
75
+ sh "rm -rvf '#{root_path}/doc'"
76
+ end
32
77
 
33
- task docfile => docsrcfiles do
34
- sh "rdoc --main README.md --title='ruby_abc ruby extension' --output=doc #{docsrcfiles}"
78
+ desc 'Cleanup everyting'
79
+ task :mrproper => :clean do
80
+ sh "rm -vf '#{ext_path}/Makefile'"
81
+ sh "rm -rvf '#{ilib_path}}'"
35
82
  end
36
83
 
data/ext/extconf.rb CHANGED
@@ -6,19 +6,19 @@ extension_name = 'ruby_abc'
6
6
 
7
7
  abc_path = File.dirname(File.expand_path(__FILE__)) + '/abc'
8
8
 
9
- abort "Library libpthread was not found" if !have_library('pthread')
10
- abort "Library libdl was not found" if !have_library('dl')
11
- abort "Library librt was not found" if !have_library('rt')
12
-
13
- unless File.exist?(abc_path + '/libabc.so') then
14
- wd = Dir.getwd
15
- Dir.chdir(abc_path)
16
- unless system("make -j4 ABC_USE_PIC=true OPTFLAGS='-O2' ABC_USE_NO_READLINE=true libabc.so") then
17
- Dir.chdir(wd)
18
- abort "Cannot build ABC"
19
- end
20
- Dir.chdir(wd)
21
- end
9
+ #abort "Library libpthread was not found" if !have_library('pthread')
10
+ #abort "Library libdl was not found" if !have_library('dl')
11
+ #abort "Library librt was not found" if !have_library('rt')
12
+ #
13
+ #unless File.exist?(abc_path + '/libabc.so') then
14
+ # wd = Dir.getwd
15
+ # Dir.chdir(abc_path)
16
+ # unless system("make -j4 ABC_USE_PIC=true OPTFLAGS='-O2' ABC_USE_NO_READLINE=true libabc.so") then
17
+ # Dir.chdir(wd)
18
+ # abort "Cannot build ABC"
19
+ # end
20
+ # Dir.chdir(wd)
21
+ #end
22
22
 
23
23
  $CFLAGS += " -I #{abc_path}/src"
24
24
  $CFLAGS += ' ' + `#{abc_path}/arch_flags`
data/lib/ruby_abc.rb CHANGED
@@ -4,7 +4,7 @@ require_relative 'ruby_abc/ruby_abc.so'
4
4
 
5
5
 
6
6
  module ABC
7
- VERSION = '0.0.1'
7
+ VERSION = '0.0.2'
8
8
 
9
9
  ##
10
10
  # call-seq:
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Théotime Bollengier
@@ -16,11 +16,14 @@ description: |-
16
16
  ABC website: http://people.eecs.berkeley.edu/~alanmi/abc/
17
17
  email:
18
18
  - theotime.bollengier@gmail.com
19
- executables: []
20
- extensions: []
19
+ executables:
20
+ - rubyabc_synthesis
21
+ extensions:
22
+ - Rakefile
21
23
  extra_rdoc_files: []
22
24
  files:
23
25
  - LICENSE
26
+ - README.md
24
27
  - Rakefile
25
28
  - bin/rubyabc_synthesis
26
29
  - ext/abc/CMakeLists.txt