HDLRuby 3.3.4 → 3.5.0
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/HDLRuby.gemspec +1 -0
- data/README.md +78 -7
- data/exe/v2hdr +3 -0
- data/ext/hruby_sim/hruby_rcsim_build.c +1 -0
- data/lib/HDLRuby/hdr_samples/adder8.v +6 -0
- data/lib/HDLRuby/hdr_samples/hard_to_route.rb +30 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb +2 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_cpu_bench.rb +2 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_cpusim_bench.rb +2 -0
- data/lib/HDLRuby/hdr_samples/verilog_parser_bench.rb +36 -0
- data/lib/HDLRuby/hdr_samples/with_generic_in_generic.rb +31 -0
- data/lib/HDLRuby/hdr_samples/with_handshake.rb +2 -0
- data/lib/HDLRuby/hdr_samples/with_memory.rb +2 -0
- data/lib/HDLRuby/hdr_samples/with_nand_board.rb +1 -1
- data/lib/HDLRuby/hdr_samples/with_reconf.rb +1 -0
- data/lib/HDLRuby/hdr_samples/with_seq_case.rb +28 -0
- data/lib/HDLRuby/hdr_samples/with_seq_if.rb +25 -0
- data/lib/HDLRuby/hdr_samples/with_seq_if_succ.rb +27 -0
- data/lib/HDLRuby/hdr_samples/with_verilog.rb +24 -0
- data/lib/HDLRuby/hdrcc.rb +84 -27
- data/lib/HDLRuby/hruby_bstr.rb +2 -2
- data/lib/HDLRuby/hruby_high.rb +80 -24
- data/lib/HDLRuby/hruby_low.rb +4 -0
- data/lib/HDLRuby/hruby_tools.rb +0 -1
- data/lib/HDLRuby/hruby_viz.rb +5060 -0
- data/lib/HDLRuby/std/sequencer.rb +28 -13
- data/lib/HDLRuby/v2hdr.rb +39 -0
- data/lib/HDLRuby/verilog_hruby.rb +1153 -0
- data/lib/HDLRuby/verilog_parser.rb +7293 -0
- data/lib/HDLRuby/version.rb +1 -1
- data/tuto/tutorial_sw.html +2772 -4079
- data/tuto/tutorial_sw.md +89 -5
- metadata +17 -6
@@ -2018,7 +2018,8 @@ module HDLRuby::High::Std
|
|
2018
2018
|
|
2019
2019
|
# Create a new sequencer for +size+ elements as +typ+ with an HW
|
2020
2020
|
# array-like accesser +access+.
|
2021
|
-
def initialize(typ,size,&access)
|
2021
|
+
# def initialize(typ,size,&access)
|
2022
|
+
def initialize(typ,size = nil,&access)
|
2022
2023
|
# Sets the size.
|
2023
2024
|
@size = size
|
2024
2025
|
# Sets the type.
|
@@ -2029,12 +2030,19 @@ module HDLRuby::High::Std
|
|
2029
2030
|
width = @size.respond_to?(:width) ? @size.width :
|
2030
2031
|
@size.respond_to?(:type) ? size.type.width : 32
|
2031
2032
|
# puts "width=#{width}"
|
2032
|
-
# Create the index and the iteration result.
|
2033
|
+
# # Create the index and the iteration result.
|
2034
|
+
# Create the index (if relevant) and the iteration result.
|
2033
2035
|
idx = nil
|
2034
2036
|
result = nil
|
2037
|
+
# HDLRuby::High.cur_system.open do
|
2038
|
+
# idx = [width].inner({
|
2039
|
+
# HDLRuby.uniq_name("enum_idx") => 0 })
|
2040
|
+
# result = typ.inner(HDLRuby.uniq_name("enum_res"))
|
2041
|
+
# end
|
2042
|
+
idx_required = @size ? true : false
|
2035
2043
|
HDLRuby::High.cur_system.open do
|
2036
2044
|
idx = [width].inner({
|
2037
|
-
HDLRuby.uniq_name("enum_idx") => 0 })
|
2045
|
+
HDLRuby.uniq_name("enum_idx") => 0 }) if idx_required
|
2038
2046
|
result = typ.inner(HDLRuby.uniq_name("enum_res"))
|
2039
2047
|
end
|
2040
2048
|
@index = idx
|
@@ -2060,26 +2068,32 @@ module HDLRuby::High::Std
|
|
2060
2068
|
# Get the next element.
|
2061
2069
|
def snext
|
2062
2070
|
@result <= @access.call(@index)
|
2063
|
-
@index <= @index + 1
|
2071
|
+
# @index <= @index + 1
|
2072
|
+
@index <= @index + 1 if @index
|
2064
2073
|
return @result
|
2065
2074
|
end
|
2066
2075
|
|
2067
2076
|
# Tell if there is a next element.
|
2068
2077
|
def snext?
|
2069
|
-
#
|
2070
|
-
return @index < @size
|
2078
|
+
# return @index < @size
|
2079
|
+
return @index ? @index < @size : true
|
2071
2080
|
end
|
2072
2081
|
|
2073
|
-
# Set the next element
|
2082
|
+
# Set the next element, also return the access result so that
|
2083
|
+
# it can be used as bidirectional transaction.
|
2074
2084
|
def snext!(val)
|
2075
|
-
@access.call(@index,val)
|
2076
|
-
@index <= @index + 1
|
2077
|
-
return val
|
2085
|
+
# @access.call(@index,val)
|
2086
|
+
# @index <= @index + 1
|
2087
|
+
# return val
|
2088
|
+
res = @access.call(@index,val)
|
2089
|
+
@index <= @index + 1 if @index
|
2090
|
+
return res
|
2078
2091
|
end
|
2079
2092
|
|
2080
2093
|
# Restart the iteration.
|
2081
2094
|
def srewind
|
2082
|
-
@index <= 0
|
2095
|
+
# @index <= 0
|
2096
|
+
@index <= 0 if @index
|
2083
2097
|
end
|
2084
2098
|
end
|
2085
2099
|
|
@@ -2325,9 +2339,10 @@ module HDLRuby::High::Std
|
|
2325
2339
|
|
2326
2340
|
# Creates an sequencer enumerator using a specific block access.
|
2327
2341
|
# - +typ+ is the data type of the elements.
|
2328
|
-
# - +size+ is the number of elements.
|
2342
|
+
# - +size+ is the number of elements, nil if not relevant.
|
2329
2343
|
# - +access+ is the block implementing the access method.
|
2330
|
-
def senumerator(typ,size,&access)
|
2344
|
+
# def senumerator(typ,size,&access)
|
2345
|
+
def senumerator(typ,size = nil,&access)
|
2331
2346
|
return SEnumeratorBase.new(typ,size,&access)
|
2332
2347
|
end
|
2333
2348
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "HDLRuby/verilog_hruby.rb"
|
2
|
+
|
3
|
+
parser = VerilogTools::Parser.new
|
4
|
+
|
5
|
+
ast = nil
|
6
|
+
|
7
|
+
HELP = "Usage: v2hdr <input verilog file name> <output HDLRuby file name>"
|
8
|
+
|
9
|
+
if ARGV[0] == "--help" then
|
10
|
+
puts HELP
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
unless ARGV.size == 2 then
|
15
|
+
puts HELP
|
16
|
+
exit(1)
|
17
|
+
end
|
18
|
+
|
19
|
+
if ARGV[0] == ARGV[1] then
|
20
|
+
puts "Error: input and output files are identical."
|
21
|
+
exit(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
begin
|
25
|
+
ast = parser.run(filename: ARGV[0], compress: true)
|
26
|
+
rescue => error
|
27
|
+
puts error
|
28
|
+
exit(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
hdlruby = ""
|
32
|
+
begin
|
33
|
+
hdlruby = ast.to_HDLRuby
|
34
|
+
rescue => error
|
35
|
+
puts error
|
36
|
+
exit(1)
|
37
|
+
end
|
38
|
+
|
39
|
+
File.open(ARGV[1],"w") { |f| f.write(hdlruby) }
|