HDLRuby 2.1.0 → 2.1.2

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: c150464dc8c76fe2fdcf37ee752a8662c8d6128b
4
- data.tar.gz: 16facc5e58f5545cf85586f541c61638ecd78733
3
+ metadata.gz: 184d23d99443c8b8dbfe750f4cbfc05322be054f
4
+ data.tar.gz: 54030243baadbc7999a265122edac715c17f8f9b
5
5
  SHA512:
6
- metadata.gz: 8402087045e3f64a50e0553a69b36dcce5b752bb16c58a0f75ffa37bddeea9b3e366f65d94abdc5abae4f9ee0532d0e8e85e8b2a254e9f18484033b17e31fa47
7
- data.tar.gz: 406803e4c457b43b52a71eec5d121d8fa09902c7943b7611c5ffd22cca5207bfb3647ee642bdbc869a7d4aff9d07d2d69d8f29878a1fdae06fbb6d650f3257bc
6
+ metadata.gz: 3bd71ebfa372f55deef0a675b64a8de523e3b12bf56a8e67a1c111de0136821c69a835b6ddf91d294e9ad145f89a3a9caa639b2bcddae2278d64b6607eeaba1b
7
+ data.tar.gz: aa617a1cf9ea4054644e484dff24b00cab51e5f3f618c9140abfd53fb682dfafd468bbd81734364e3961c9dc4b22de7c6b5e6ecd060cde15ca6d6790e6b3d5e0
data/HDLRuby.gemspec CHANGED
@@ -24,7 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.extra_rdoc_files = ["README.md"]
25
25
  spec.bindir = "exe"
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
- spec.require_paths = ["lib"]
27
+ # spec.require_paths = ["lib"]
28
+ spec.require_paths = ["lib","lib/HDLRuby"]
28
29
 
29
30
  spec.required_ruby_version = '>= 2.0'
30
31
  spec.add_development_dependency "bundler", "~> 2.0.1"
data/README.md CHANGED
@@ -1923,11 +1923,7 @@ For example, the following code describes an empty system with two generic param
1923
1923
  system(:nothing) { |a,b| }
1924
1924
  ```
1925
1925
 
1926
- The generic parameters can be anything: values, data types, systems, Ruby variables, and so on. For example, the following system uses generic argument
1927
- `t` as a type for an input signal, generic argument `w` as a bit range for an
1928
- output signal and generic argument `s` as a system used for creating instance
1929
- `sI` whose input and output signals `i` and `o` are connected respectively to
1930
- signals `isig` and `osig`.
1926
+ The generic parameters can be anything: values, data types, signals, systems, Ruby variables, and so on. For example, the following system uses generic argument `t` as a type for an input signal, generic argument `w` as a bit range for an output signal and generic argument `s` as a system used for creating instance `sI` whose input and output signals `i` and `o` are connected respectively to signals `isig` and `osig`.
1931
1927
 
1932
1928
  ```ruby
1933
1929
  system :something do |t,w,s|
@@ -1995,7 +1991,7 @@ end
1995
1991
 
1996
1992
  __Note:__
1997
1993
 
1998
- - In the example above, generic parameter `param` of `sybsys_gen` is used for specializing system `sys`.
1994
+ - In the example above, generic parameter `param` of `subsys_gen` is used for specializing system `sys`.
1999
1995
 
2000
1996
 
2001
1997
  ##### Specializing generic types
@@ -2009,6 +2005,27 @@ A generic type is specialized by invoking its name and passing as argument the v
2009
2005
  If less values are provided than the number of generic arguments, the type is partially specialized. However, only a fully specialized type can be used for declaring signals.
2010
2006
 
2011
2007
 
2008
+ ##### Use of signals as generic parameters
2009
+
2010
+ Signals passed as generic arguments to systems can be used for making generic connections to the instance of the system. For that purpose, the generic argument has to be declared as input, output or inout port in the body of the system as follows:
2011
+
2012
+ ```ruby
2013
+ system :<system_name> do |sig|
2014
+ sig.input :my_sig
2015
+ ...
2016
+ end
2017
+ ```
2018
+
2019
+ In the code above, `sig` is a generic argument assumed to be a signal. The second line declares the port to which sig will connected to when instantiating. From there, port `my_sig` can be used like any other port of the system. Such a system is them instantiated as follows:
2020
+
2021
+ ```ruby
2022
+ system_name(some_sig) :<instance_name>
2023
+ ```
2024
+
2025
+ In the code above, `some_sig` is a signal available in the current context. This instantiation automatically connects `some_sig` to the instance.
2026
+
2027
+
2028
+
2012
2029
  ### Inheritance
2013
2030
  <a name="inherit"></a>
2014
2031
 
@@ -2715,8 +2732,11 @@ This library provides a unified interface to complex communication protocols thr
2715
2732
 
2716
2733
  A channel is used similarly to a pipe: it has an input where data can be written and an output where data can be read. The ordering of the data and the synchronization depend on the internals of the channel, e.g., a channel can be FIFO or LIFO. The interaction with the channel is done using the following methods:
2717
2734
 
2718
- * `writer_ports`: generate ports in the system for writing to the channel. This method is used without any argument.
2719
- * `reader_ports`: generate ports in the system for reading from the channel. This method is used without any argument.
2735
+ * `output <name>`: generate ports in the system for writing to the channel and associate them to `name`
2736
+ * `input <name>`: generate ports in the system for reading from the channel amd associate them to `name`
2737
+
2738
+ When the channel ports are declared, they can be accessed using the following methods depending on whether they are writing or reading ports:
2739
+
2720
2740
  * `write(<value>) <block>`: write `value` to the channel and execute `block` when `write` completes. Both `value` and `block` may be omitted depending on the kind of channel.
2721
2741
  * `read(<target>) <block>`: read the channel, assign the result to signal `target` and execute `block` when the read completes. Both `target` and `block` may be omitted depending on the kind of channel.
2722
2742
 
@@ -2727,7 +2747,7 @@ system :producer8 do |channel|
2727
2747
  # Inputs of the producer: clock and reset.
2728
2748
  input :clk, :rst
2729
2749
  # Instantiate the channel ports
2730
- channel.writer_ports
2750
+ channel.output :chi
2731
2751
  # Inner 8-bit counter for generating values.
2732
2752
  [8].inner :counter
2733
2753
 
@@ -2735,7 +2755,7 @@ system :producer8 do |channel|
2735
2755
  par(clk.posedge) do
2736
2756
  hif(rst) { counter <= 0 }
2737
2757
  helse do
2738
- channel.write(counter) { counter <= counter + 1 }
2758
+ chi.write(counter) { counter <= counter + 1 }
2739
2759
  end
2740
2760
  end
2741
2761
  end
@@ -2814,17 +2834,12 @@ And in case there are generic parameter, the instantiation procedure is as follo
2814
2834
  <channel name>(:<instance name>).(<generic parameters>)
2815
2835
  ```
2816
2836
 
2817
- After a channel is instantiated, it must be linked to the circuits that will communicate through it. This is done when instantiating these circuits. If a circuit reads on the channel, it will be instantiated as follows:
2837
+ After a channel is instantiated, it must be linked to the circuits that will communicate through it. This is done when instantiating these circuits. If a circuit reads or writes on the channel, it will be instantiated as follows:
2818
2838
 
2819
2839
  ```ruby
2820
- <system name>(<channel instance>).(:<instance name>).(<circuit standard connections>,*<channel instance>.reader_signals)
2840
+ <system name>(<channel instance>).(:<instance name>).(<circuit standard connections>)
2821
2841
  ```
2822
2842
 
2823
- If the circuit writes on the channel, it must be instantiated as follows:
2824
-
2825
- ```ruby
2826
- <system name>(<channel instance>).(:<instance name>).(<circuit standard connections>,*<channel instance>.writer_signals)
2827
- ```
2828
2843
 
2829
2844
  __Notes__:
2830
2845
 
@@ -2846,10 +2861,10 @@ system :producer_consumer8 do
2846
2861
  regchI.reset.at(rst.posedge)
2847
2862
 
2848
2863
  # Instantiate the producer.
2849
- producer8(regch).(:producerI).(clk,rst,*regch.writer_signals)
2864
+ producer8(regch).(:producerI).(clk,rst)
2850
2865
 
2851
2866
  # Instantiate the consumer.
2852
- consumer8(regch).(:consumerI).(clk.rst,*regch.reader_signals)
2867
+ consumer8(regch).(:consumerI).(clk.rst)
2853
2868
  end
2854
2869
  ```
2855
2870
 
@@ -1,4 +1,4 @@
1
- require '../std/fsm.rb'
1
+ require 'std/fsm.rb'
2
2
 
3
3
  include HDLRuby::High::Std
4
4
 
@@ -1,5 +1,5 @@
1
- require '../std/fsm.rb'
2
- require '../std/decoder.rb'
1
+ require 'std/fsm.rb'
2
+ require 'std/decoder.rb'
3
3
  include HDLRuby::High::Std
4
4
 
5
5
  # A simple implementation of the MEI8 processor.
@@ -1,5 +1,5 @@
1
- require '../std/fsm.rb'
2
- require '../std/decoder.rb'
1
+ require 'std/fsm.rb'
2
+ require 'std/decoder.rb'
3
3
  include HDLRuby::High::Std
4
4
 
5
5
  # A simple implementation of the MEI8 processor.
@@ -1,4 +1,4 @@
1
- require '../std/fsm.rb'
1
+ require 'std/fsm.rb'
2
2
  include HDLRuby::High::Std
3
3
 
4
4
  # A sequential 16x16 -> 32 multer
@@ -1,5 +1,4 @@
1
-
2
- require '../std/channel.rb'
1
+ require 'std/channel.rb'
3
2
 
4
3
  include HDLRuby::High::Std
5
4
 
@@ -1,4 +1,4 @@
1
- require '../std/decoder.rb'
1
+ require 'std/decoder.rb'
2
2
  include HDLRuby::High::Std
3
3
 
4
4
  # Implementation of a decoder.
@@ -1,4 +1,4 @@
1
- require '../std/fsm.rb'
1
+ require 'std/fsm.rb'
2
2
 
3
3
  include HDLRuby::High::Std
4
4
 
@@ -1,4 +1,4 @@
1
- require '../std/reconf.rb'
1
+ require 'std/reconf.rb'
2
2
 
3
3
  include HDLRuby::High::Std
4
4
 
data/lib/HDLRuby/hdrcc.rb CHANGED
@@ -54,6 +54,14 @@ module HDLRuby
54
54
  @dir = dir.to_s
55
55
  @params = params
56
56
 
57
+ # The list of the standard library files to exclude for
58
+ # checking.
59
+ # Get the directory of the HDLRuby and Ruby standard libraries.
60
+ @std_dirs = $LOAD_PATH
61
+ # @std_dirs << File.dirname(__FILE__) + "/std"
62
+ # # Gather the files with their path to std.
63
+ # @std_files = Dir[@std_dir + "/*"]
64
+
57
65
  # The list of required files.
58
66
  @requires = []
59
67
 
@@ -70,19 +78,45 @@ module HDLRuby
70
78
 
71
79
  # Loads a single +file+.
72
80
  def read(file)
73
- @texts << File.read(File.join(@dir,file) )
74
- @checks << Checker.new(@texts[-1],file)
81
+ # Resolve the file.
82
+ found = File.join(@dir,file)
83
+ unless File.exist?(found) then
84
+ founds = Dir.glob(@std_dirs.map {|path| File.join(path,file) })
85
+ if founds.empty? then
86
+ # No standard file with this name, this is an error.
87
+ raise "Unknown required file: #{file}."
88
+ else
89
+ # A standard file is found, skip it since it does not
90
+ # need to be read.
91
+ # puts "Standard files: #{founds}"
92
+ return false
93
+ end
94
+ end
95
+ # Load the file.
96
+ # @texts << File.read(File.join(@dir,file) )
97
+ @texts << File.read(found)
98
+ # @checks << Checker.new(@texts[-1],file)
99
+ @checks << Checker.new(@texts[-1],found)
100
+ return true
75
101
  end
76
102
 
77
103
  # Loads all the files from +file+.
78
104
  def read_all(file = @top_file)
79
105
  # puts "read_all with file=#{file}"
80
106
  # Read the file
81
- read(file)
107
+ # read(file)
108
+ unless read(file) then
109
+ # The file is to skip.
110
+ return
111
+ end
82
112
  # Get its required files.
83
113
  requires = @checks[-1].get_all_requires
84
114
  requires.each do |file|
85
- read_all(file) if file != "HDLRuby"
115
+ # if file != "HDLRuby" &&
116
+ # !@std_files.find { |std| std.include?(file) } then
117
+ # read_all(file)
118
+ # end
119
+ read_all(file)
86
120
  end
87
121
  @requires += requires
88
122
  @requires.uniq!
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-20 00:00:00.000000000 Z
11
+ date: 2020-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -280,6 +280,7 @@ post_install_message:
280
280
  rdoc_options: []
281
281
  require_paths:
282
282
  - lib
283
+ - lib/HDLRuby
283
284
  required_ruby_version: !ruby/object:Gem::Requirement
284
285
  requirements:
285
286
  - - ">="