rvvm 0.9.4 → 1.0.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/CHANGELOG.md +31 -0
- data/README.md +1 -1
- data/bin/sandbox +0 -22
- data/lib/rvvm/crayons.rb +135 -0
- data/lib/rvvm/templates.rb +3 -3
- data/lib/rvvm/utils.rb +6 -4
- data/lib/rvvm/version.rb +1 -1
- data/lib/rvvm.rb +135 -62
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9232781d6d02b88aa6d9442091845ad5a167046cc6149fffa4b69323dbcef3f2
|
4
|
+
data.tar.gz: b1777bfa093994e1d9e6abac38aea4e286fb13099a9f1fdb1ad4c37daeb5b134
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3a0253c53db3ffba91ffa310b0cba9001f5b5d34efd70cdc1f85fef13e09149ed0afcf117ebec4e28d22aa1c1a31e324b963a23515a6ab52dba6423f43e5d0d
|
7
|
+
data.tar.gz: 17c5b7eb71ac667fff426a7570c8e86f98a0a3ddfbc59d034fbb24820074799cbc8cd595fa5f0666e8dc60e4edd9c992e6048497e8f0b2382ee4835689b9d878
|
data/CHANGELOG.md
CHANGED
@@ -114,3 +114,34 @@
|
|
114
114
|
2. Template file generation in pwd
|
115
115
|
3. Elaboration and simulation custom waveform trace dump file
|
116
116
|
4. Project template files regeneration/restoration to default
|
117
|
+
|
118
|
+
## [0.9.5] - 2024-09-17
|
119
|
+
|
120
|
+
### Fixed:
|
121
|
+
|
122
|
+
1. Conversion of parsed json config hash keys to symbols
|
123
|
+
2. Tests randomly failing due to the bug above
|
124
|
+
|
125
|
+
### TBI:
|
126
|
+
|
127
|
+
1. CLI log graphic
|
128
|
+
2. Template file generation in pwd
|
129
|
+
3. Elaboration and simulation custom waveform trace dump file
|
130
|
+
4. Project template files regeneration/restoration to default
|
131
|
+
|
132
|
+
## [1.0.0] - 2024-09-17
|
133
|
+
|
134
|
+
### Added:
|
135
|
+
|
136
|
+
1. CLI log graphics (Crayons module)
|
137
|
+
2. Template file generation in pwd
|
138
|
+
|
139
|
+
### Fixed:
|
140
|
+
|
141
|
+
1. Missing testlist arg conversion to array
|
142
|
+
2. Module/itf template creation
|
143
|
+
|
144
|
+
### TBI:
|
145
|
+
|
146
|
+
1. Elaboration and simulation custom waveform trace dump file
|
147
|
+
2. Project template files regeneration/restoration to default
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# RVvM - Ruby Vivado Manager
|
1
|
+
# RVvM - Ruby Vivado Manager [](https://badge.fury.io/rb/rvvm)
|
2
2
|
|
3
3
|
RVvM is a Ruby based meta tool to manage, compile, elaborate and simulate SystemVerilog and UVM based projects using Xilinx Vivado xvlog, xelab, xrun and xsc tools.
|
4
4
|
|
data/bin/sandbox
CHANGED
@@ -2,25 +2,3 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# just a sandbox to play with ruby during development
|
5
|
-
|
6
|
-
require "json"
|
7
|
-
|
8
|
-
json = %(
|
9
|
-
{
|
10
|
-
"sizmaj": "bit"
|
11
|
-
"akafuka" : {
|
12
|
-
"siz": 1,
|
13
|
-
"maj": 2,
|
14
|
-
"bit": 3
|
15
|
-
}
|
16
|
-
}
|
17
|
-
)
|
18
|
-
|
19
|
-
def json_parse(data)
|
20
|
-
parsed = JSON.parse(data)
|
21
|
-
puts parsed
|
22
|
-
rescue JSON::ParserError => e
|
23
|
-
puts "Invalid JSON!\nError #{e.message}"
|
24
|
-
end
|
25
|
-
|
26
|
-
json_parse(json)
|
data/lib/rvvm/crayons.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tty-spinner"
|
4
|
+
require "rainbow/refinement"
|
5
|
+
|
6
|
+
using Rainbow
|
7
|
+
|
8
|
+
# Utility module providing spinners and stdout mesage formatting.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# require 'rvvm/crayons'
|
12
|
+
#
|
13
|
+
# Crayons.spinner_start("New task...")
|
14
|
+
#
|
15
|
+
# # do stuff
|
16
|
+
#
|
17
|
+
# Crayons.spinner_log("Halfway done! ^^")
|
18
|
+
#
|
19
|
+
# # do some more stuff
|
20
|
+
#
|
21
|
+
# Crayons.spinner_stop("Completed!", true)
|
22
|
+
# Crayons.log_pass("Oof, im done now...")
|
23
|
+
#
|
24
|
+
# @since 1.0.0
|
25
|
+
module Crayons
|
26
|
+
# module variables to hold instances of a
|
27
|
+
# running spinner and its thread
|
28
|
+
@spinner = nil
|
29
|
+
@thread = nil
|
30
|
+
@thread_paused = false
|
31
|
+
@spinner_running = false
|
32
|
+
|
33
|
+
# Returns spinner status.
|
34
|
+
#
|
35
|
+
# @returns @spinner_running [Boolean] spinner status
|
36
|
+
def self.spinner_running?
|
37
|
+
@spinner_running
|
38
|
+
end
|
39
|
+
|
40
|
+
# Starts a cli spinner appending the provided message.
|
41
|
+
#
|
42
|
+
# @param message [String] text to append to the spinner
|
43
|
+
#
|
44
|
+
# @return [void]
|
45
|
+
#
|
46
|
+
# @since 1.0.0
|
47
|
+
def self.spinner_start(message)
|
48
|
+
sleep(0.1)
|
49
|
+
print "\r\e[K"
|
50
|
+
@spinner = TTY::Spinner.new("[:spinner] #{message}")
|
51
|
+
@spinner_running = true
|
52
|
+
@thread = Thread.new do
|
53
|
+
@spinner.auto_spin
|
54
|
+
sleep(0.1) while @thread_paused
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Pauses spinner thread execution to enable uninterrupted stdout outputs.
|
59
|
+
#
|
60
|
+
# @return [void]
|
61
|
+
#
|
62
|
+
# @since 1.0.0
|
63
|
+
def self.spinner_pause
|
64
|
+
return unless @spinner_running
|
65
|
+
|
66
|
+
print "\r\e[K"
|
67
|
+
@thread_paused = true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Resumes spinner thread execution.
|
71
|
+
#
|
72
|
+
# @return [void]
|
73
|
+
#
|
74
|
+
# @since 1.0.0
|
75
|
+
def self.spinner_resume
|
76
|
+
@thread_paused = false if @spinner_running
|
77
|
+
end
|
78
|
+
|
79
|
+
# Stops spinner printing a formated status message.
|
80
|
+
#
|
81
|
+
# @param message [String] status message to print
|
82
|
+
# @param exit [Boolean] return code (true - success, false - error)
|
83
|
+
#
|
84
|
+
# @return [void]
|
85
|
+
#
|
86
|
+
# @since 1.0.0
|
87
|
+
def self.spinner_stop(message = nil, exit)
|
88
|
+
return unless @spinner_running
|
89
|
+
|
90
|
+
spinner_message = message || (exit ? "Done!" : "Failed!")
|
91
|
+
exit ? @spinner.success(spinner_message.green) : @spinner.error(spinner_message.red)
|
92
|
+
@thread.join
|
93
|
+
sleep(0.1)
|
94
|
+
@spinner_running = false
|
95
|
+
print "\r\e[K"
|
96
|
+
end
|
97
|
+
|
98
|
+
# Logs a message during spinner execution removing the need
|
99
|
+
# to manually pause and resume spinner.
|
100
|
+
#
|
101
|
+
# If a spinner is not running simply prints message.
|
102
|
+
#
|
103
|
+
# @param message [String] message to prin
|
104
|
+
#
|
105
|
+
# @return [void]
|
106
|
+
#
|
107
|
+
# @since 1.0.0
|
108
|
+
def self.spinner_log(message)
|
109
|
+
spinner_pause if @spinner_running
|
110
|
+
puts message
|
111
|
+
spinner_resume if @spinner_running
|
112
|
+
end
|
113
|
+
|
114
|
+
# Logs a green text message to stdout.
|
115
|
+
#
|
116
|
+
# @param message [String] message to print
|
117
|
+
#
|
118
|
+
# @return [void]
|
119
|
+
#
|
120
|
+
# @since 1.0.0
|
121
|
+
def self.log_pass(message)
|
122
|
+
puts message.green
|
123
|
+
end
|
124
|
+
|
125
|
+
# Logs a red text message to stdout.
|
126
|
+
#
|
127
|
+
# @param message [String] message to print
|
128
|
+
#
|
129
|
+
# @return [void]
|
130
|
+
#
|
131
|
+
# @since 1.0.0
|
132
|
+
def self.log_error(message)
|
133
|
+
puts message.red
|
134
|
+
end
|
135
|
+
end
|
data/lib/rvvm/templates.rb
CHANGED
@@ -136,7 +136,7 @@ endmodule: ${prjname}_tb_top
|
|
136
136
|
type: "module",
|
137
137
|
module: "best_rtl_module_ever",
|
138
138
|
date: "01/01/2024 00:00",
|
139
|
-
prjname: "
|
139
|
+
prjname: " ",
|
140
140
|
company: " ",
|
141
141
|
username: "me"
|
142
142
|
},
|
@@ -175,7 +175,7 @@ end${type}
|
|
175
175
|
package: "best_rtl_pkg",
|
176
176
|
PACKAGE: "BEST_RTL_PACKAGE",
|
177
177
|
date: "01/01/2024 00:00",
|
178
|
-
prjname: "
|
178
|
+
prjname: " ",
|
179
179
|
company: " ",
|
180
180
|
username: "me"
|
181
181
|
},
|
@@ -215,7 +215,7 @@ endpackage
|
|
215
215
|
conf: {
|
216
216
|
NAME: "BEST_RTL_FILE",
|
217
217
|
date: "01/01/2024 00:00",
|
218
|
-
prjname: "
|
218
|
+
prjname: " ",
|
219
219
|
company: " ",
|
220
220
|
username: "me"
|
221
221
|
},
|
data/lib/rvvm/utils.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative "crayons"
|
4
|
+
|
3
5
|
# Utils module providing utilities and helper methods to rvvm.
|
4
6
|
#
|
5
7
|
# Mainly used to generate files and templates.
|
@@ -35,7 +37,8 @@ module Utils
|
|
35
37
|
file.write(content)
|
36
38
|
end
|
37
39
|
rescue StandardError => e
|
38
|
-
|
40
|
+
Crayons.spinner_stop("Error!", false) if Crayons.spinner_running?
|
41
|
+
Crayons.log_error("\nFailed to create a file!\n #{e.message}")
|
39
42
|
end
|
40
43
|
|
41
44
|
# Generates a file based on a template.
|
@@ -54,7 +57,7 @@ module Utils
|
|
54
57
|
filename = name || template[:file][:name]
|
55
58
|
filepath = path || template[:file][:path]
|
56
59
|
|
57
|
-
|
60
|
+
Crayons.spinner_log("Generating: #{filepath}/#{filename}")
|
58
61
|
gen_file("#{filepath}/#{filename}", content)
|
59
62
|
end
|
60
63
|
|
@@ -96,7 +99,7 @@ module Utils
|
|
96
99
|
username = handle.read
|
97
100
|
end
|
98
101
|
|
99
|
-
username
|
102
|
+
username&.strip!
|
100
103
|
username
|
101
104
|
end
|
102
105
|
|
@@ -113,7 +116,6 @@ module Utils
|
|
113
116
|
array.each do |key|
|
114
117
|
return false if hash[key]
|
115
118
|
end
|
116
|
-
|
117
119
|
true
|
118
120
|
end
|
119
121
|
end
|
data/lib/rvvm/version.rb
CHANGED
data/lib/rvvm.rb
CHANGED
@@ -28,6 +28,7 @@ module Rvvm
|
|
28
28
|
@templates = Templates.load
|
29
29
|
@config_path = nil
|
30
30
|
@config = nil
|
31
|
+
@formatted_time = nil
|
31
32
|
|
32
33
|
# Instance variables to hold parsed args and required arg symbol list
|
33
34
|
@args = {}
|
@@ -52,15 +53,15 @@ module Rvvm
|
|
52
53
|
# Script argument parsing block.
|
53
54
|
# Runs on loading the module using require.
|
54
55
|
OptionParser.new do |args|
|
56
|
+
current_time = Time.now
|
57
|
+
@formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
|
58
|
+
|
55
59
|
args.on("-h", "--help", "Shows this help") do
|
56
60
|
puts "\nRVvM - Ruby Vivado Manager\n\n"
|
57
61
|
puts "\tRVvM is a Ruby based tool to manage, compile, elaborate and simulate SystemVerilog and UVM based projects"
|
58
62
|
puts "\tusing Xilinx Vivado xvlog, xelab, xrun and xsc.\n\n"
|
59
63
|
puts args
|
60
64
|
|
61
|
-
@current_time = Time.now
|
62
|
-
@formatted_time = @current_time.strftime("%Y-%m-%d %H:%M:%S")
|
63
|
-
|
64
65
|
req_args = String.new
|
65
66
|
@required_args.each do |arg|
|
66
67
|
req_args << "--#{arg} "
|
@@ -74,11 +75,12 @@ module Rvvm
|
|
74
75
|
end
|
75
76
|
|
76
77
|
args.on("-n", "--new NAME", "Creates a new project wit the prowided name under pwd")
|
77
|
-
args.on("--module NAME", "Creates a SystemVerilog module template (default path: <prj dir>/design/src)")
|
78
|
+
args.on("-m", "--module NAME", "Creates a SystemVerilog module template (default path: <prj dir>/design/src)")
|
78
79
|
args.on("--pkg NAME", "Creates a SystemVerilog package template (default path: <prj dir>/design/pkg)")
|
79
80
|
args.on("--itf NAME", "Creates a SystemVerilog interface template (default path: <prj dir>/design/itf)")
|
80
81
|
args.on("--svfile NAME", "Creates a generic SystemVerilog file template (default path: <prj dir>/design/src)")
|
81
82
|
args.on("--path PATH", "Specifies a path relative to <prj dir> when creating a file template")
|
83
|
+
args.on("--here", "Specifies pwd as the path for template file creation.")
|
82
84
|
args.on("-c", "--comp", "Compile SystemVerilog sources")
|
83
85
|
args.on("-e", "--elab", "Elaborates project")
|
84
86
|
args.on("-r", "--run", "Runs UVM simulation")
|
@@ -97,7 +99,7 @@ module Rvvm
|
|
97
99
|
args.on("--simlog LOGNAME", "Specifies simulation log name (overwrites config)")
|
98
100
|
args.on("--test TESTNAME", "Specifies UVM test to be run by --run (overwrites config)")
|
99
101
|
args.on("-b", "--batch", "Run a batch of UVM tests from a test list (overwrites config)")
|
100
|
-
args.on("--testlist TESTLIST", "Specifies test list for a batch of test run (overwrites config)")
|
102
|
+
args.on("--testlist TESTLIST", Array, "Specifies test list as a comma separated string for a batch of test run (overwrites config)")
|
101
103
|
args.on("--verb VERBOSITY", "Specifies UVM verbosity <LOW, MEDIUM, HIGH, FULL, DEBUG> (overwrites config)")
|
102
104
|
args.on("--simtb TBNAME", "Specifies testbench snapshot for simulation (overwrites config)")
|
103
105
|
args.on("--dpilist LISTFILE", "Specifies source file list for DPI-C compilation (overwrites config)")
|
@@ -121,10 +123,12 @@ module Rvvm
|
|
121
123
|
end
|
122
124
|
|
123
125
|
# Check if a required arg is provided
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
126
|
+
return unless Utils.all_nil?(@args, @required_args)
|
127
|
+
|
128
|
+
puts ""
|
129
|
+
Crayons.log_error("No required options provided!")
|
130
|
+
puts "For more info use -h or --help\n\n"
|
131
|
+
exit(1)
|
128
132
|
end
|
129
133
|
|
130
134
|
# Argument collision handling and additional settings for
|
@@ -159,7 +163,8 @@ module Rvvm
|
|
159
163
|
# @since 0.8.0
|
160
164
|
def self.execute(command)
|
161
165
|
if @args[:debug]
|
162
|
-
|
166
|
+
Crayons.spinner_log(command)
|
167
|
+
sleep(1)
|
163
168
|
else
|
164
169
|
system(command)
|
165
170
|
end
|
@@ -173,20 +178,19 @@ module Rvvm
|
|
173
178
|
#
|
174
179
|
# @since 0.8.0
|
175
180
|
def self.create_new_project(name)
|
176
|
-
puts "\nRVvM: Generating new project: #{name} ...\n"
|
177
|
-
|
178
181
|
if File.exist?(name)
|
179
|
-
print "
|
182
|
+
print "\nDirectory #{name} already exists. Do you want to overwrite it? [y/n] "
|
180
183
|
input = gets.chomp
|
181
|
-
puts "
|
184
|
+
puts ""
|
182
185
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
end
|
186
|
+
exit(0) unless input == "y"
|
187
|
+
FileUtils.rm_rf(name)
|
188
|
+
else
|
189
|
+
puts ""
|
188
190
|
end
|
189
191
|
|
192
|
+
Crayons.spinner_start("Generating new project: #{name}...")
|
193
|
+
|
190
194
|
FileUtils.mkdir(name)
|
191
195
|
Dir.chdir(name)
|
192
196
|
|
@@ -236,16 +240,20 @@ module Rvvm
|
|
236
240
|
temp_conf[:PRJNAME] = name.upcase
|
237
241
|
Utils.gen_template(@templates[:tbtop], "#{name}_tb_top.sv", temp_conf)
|
238
242
|
|
239
|
-
|
243
|
+
Crayons.spinner_log(" ")
|
244
|
+
Crayons.spinner_pause
|
240
245
|
system("git init")
|
241
246
|
system("git add .")
|
242
247
|
system('git commit -am "Initial commit"')
|
248
|
+
Crayons.spinner_resume
|
243
249
|
|
244
|
-
|
250
|
+
Crayons.spinner_stop("Done!", true)
|
251
|
+
Crayons.log_pass("\nRVvM: New project generated. ^^\n\n")
|
245
252
|
|
246
253
|
exit(0)
|
247
254
|
rescue StandardError => e
|
248
|
-
|
255
|
+
Crayons.spinner_stop("Error!", false) if Crayons.spinner_running?
|
256
|
+
Crayons.log_error("RVvM failed to create project...\n\n#{e.message}\n")
|
249
257
|
exit(1)
|
250
258
|
end
|
251
259
|
|
@@ -256,23 +264,30 @@ module Rvvm
|
|
256
264
|
#
|
257
265
|
# @since 0.8.0
|
258
266
|
def self.load_config
|
259
|
-
puts "
|
267
|
+
puts ""
|
268
|
+
Crayons.spinner_start("Loading RVvM project config...")
|
260
269
|
|
261
270
|
@config_path = Utils.find_file_dir("rvvmconf.json", ".")
|
262
271
|
json_file = File.read("#{@config_path}/rvvmconf.json") if @config_path
|
263
272
|
|
264
273
|
unless json_file
|
265
|
-
|
266
|
-
|
274
|
+
Crayons.log_error(" Failed to load config file!\n")
|
275
|
+
Crayons.log_error(" Make sure you are inside an RVvM project.\n\n")
|
267
276
|
exit(1)
|
268
277
|
end
|
269
278
|
|
270
279
|
@config = JSON.parse(json_file) if json_file
|
271
|
-
|
272
|
-
|
273
|
-
|
280
|
+
|
281
|
+
if @config.instance_of?(Hash)
|
282
|
+
@config = @config.transform_values do |v|
|
283
|
+
v.transform_keys(&:to_sym) if v.instance_of?(Hash)
|
284
|
+
end.transform_keys(&:to_sym)
|
285
|
+
end
|
286
|
+
|
287
|
+
Crayons.spinner_stop(nil, true)
|
288
|
+
puts ""
|
274
289
|
rescue JSON::ParserError => e
|
275
|
-
|
290
|
+
Crayons.log_error(" Invalid config json!\n\n#{e.message}")
|
276
291
|
exit(1)
|
277
292
|
end
|
278
293
|
|
@@ -295,10 +310,14 @@ module Rvvm
|
|
295
310
|
logname = @args[:complog] || File.join([@config[:project][:logDir], @config[:compilation][:logDir], @config[:compilation][:log]])
|
296
311
|
complist = @args[:compilelist] || @config[:compilation][:list]
|
297
312
|
|
298
|
-
|
313
|
+
Crayons.spinner_start("Compiling HDL sources...")
|
299
314
|
|
300
315
|
cmd = "xvlog -sv -f #{complist} -log #{logname} #{cmd_args}"
|
301
|
-
|
316
|
+
Crayons.spinner_pause
|
317
|
+
exit = execute(cmd)
|
318
|
+
Crayons.spinner_resume
|
319
|
+
Crayons.spinner_stop(nil, exit)
|
320
|
+
puts ""
|
302
321
|
end
|
303
322
|
|
304
323
|
# Compiles C/C++ sources into a shared library to use during
|
@@ -311,10 +330,12 @@ module Rvvm
|
|
311
330
|
cmd_args = @config[:dpi][:args]
|
312
331
|
dpilist = @args[:dpilist] || @config[:dpi][:list]
|
313
332
|
|
314
|
-
|
333
|
+
Crayons.spinner_start("Building DPI-C library...")
|
315
334
|
|
316
335
|
cmd = "sxc -f #{dpilist} #{cmd_args}"
|
317
|
-
execute(cmd)
|
336
|
+
exit = execute(cmd)
|
337
|
+
Crayons.spinner_stop(nil, exit)
|
338
|
+
puts ""
|
318
339
|
end
|
319
340
|
|
320
341
|
# Elaborates project into a testbench snapshot using xelab.
|
@@ -331,12 +352,14 @@ module Rvvm
|
|
331
352
|
tb = @args[:tb] || @config[:elaboration][:tb]
|
332
353
|
timescale = @args[:timescale] || @config[:elaboration][:timescale]
|
333
354
|
|
334
|
-
|
335
|
-
puts " TB TOP: \t#{tb_top}"
|
336
|
-
puts " SNAPSHOT:\t#{tb}\n"
|
355
|
+
Crayons.spinner_start("Elaborating testbench: #{tb}...")
|
337
356
|
|
338
357
|
cmd = "xelab #{tb_top} -relax -s #{tb} -timescale #{timescale} -log #{logname} #{cmd_args}"
|
339
|
-
|
358
|
+
Crayons.spinner_pause
|
359
|
+
exit = execute(cmd)
|
360
|
+
Crayons.spinner_resume
|
361
|
+
Crayons.spinner_stop(nil, exit)
|
362
|
+
puts ""
|
340
363
|
end
|
341
364
|
|
342
365
|
# Runs UVM test simulation on an elaborated testbench snapshot using xrun.
|
@@ -351,7 +374,7 @@ module Rvvm
|
|
351
374
|
else
|
352
375
|
cmd_args << "-R"
|
353
376
|
end
|
354
|
-
|
377
|
+
|
355
378
|
# Run simulaton on an array of tests.
|
356
379
|
# If in not running in batch mode testlist is an array with a single test
|
357
380
|
test = @args[:test] || @config[:simulation][:defTest]
|
@@ -360,10 +383,10 @@ module Rvvm
|
|
360
383
|
|
361
384
|
tb = @args[:simtb] || @args[:tb] || @config[:elaboration][:tb]
|
362
385
|
|
363
|
-
puts ""
|
364
|
-
|
365
386
|
testlist.each_with_index do |simtest, i|
|
366
|
-
|
387
|
+
simtest.strip!
|
388
|
+
puts "" if i.positive?
|
389
|
+
Crayons.spinner_start("Running test #{i + 1}/#{testlist.size}: #{simtest}...")
|
367
390
|
|
368
391
|
logname = File.join([@config[:project][:logDir], @config[:simulation][:logDir], @config[:simulation][:log]])
|
369
392
|
logname = Utils.interpolate(logname, { testname: simtest })
|
@@ -371,8 +394,13 @@ module Rvvm
|
|
371
394
|
verb = "UVM_#{@args[:verb] || @config[:simulation][:verbosity]}"
|
372
395
|
|
373
396
|
cmd = "xsim #{tb} -log #{logname} -testplusarg \"UVM_VERBOSITY=#{verb}\" -testplusarg \"UVM_TESTNAME=#{simtest}\" #{cmd_args}"
|
374
|
-
|
397
|
+
Crayons.spinner_pause
|
398
|
+
exit = execute(cmd)
|
399
|
+
Crayons.spinner_resume
|
400
|
+
Crayons.spinner_stop(nil, exit)
|
375
401
|
end
|
402
|
+
|
403
|
+
puts ""
|
376
404
|
end
|
377
405
|
|
378
406
|
# Runs a pure SystemVerilog/Verilog simulation using xrun.
|
@@ -384,13 +412,16 @@ module Rvvm
|
|
384
412
|
cmd_args = @config[:simulation][:args]
|
385
413
|
tb = @args[:simtb] || @args[:tb] || @config[:elaboration][:tb]
|
386
414
|
|
387
|
-
|
415
|
+
Crayons.spinner_start("Running pure SV/V simulation...")
|
388
416
|
logname = @args[:simlog] || File.join([@config[:project][:logDir], @config[:simulation][:logDir], "svsim.log"])
|
389
417
|
|
390
418
|
cmd = "xsim #{tb} -log #{logname} #{cmd_args}"
|
391
|
-
|
419
|
+
Crayons.spinner_pause
|
420
|
+
exit = execute(cmd)
|
421
|
+
Crayons.spinner_resume
|
422
|
+
Crayons.spinner_stop(nil, exit)
|
392
423
|
end
|
393
|
-
|
424
|
+
|
394
425
|
# Opens last generated waveform trace dump to inspect in Vivado GUI.
|
395
426
|
#
|
396
427
|
# @return [void]
|
@@ -401,6 +432,8 @@ module Rvvm
|
|
401
432
|
|
402
433
|
cmd = "xsim --gui #{dump}"
|
403
434
|
execute(cmd)
|
435
|
+
|
436
|
+
exit(0)
|
404
437
|
end
|
405
438
|
|
406
439
|
# Generates UVM test functional coverage report using xcrg.
|
@@ -409,8 +442,13 @@ module Rvvm
|
|
409
442
|
#
|
410
443
|
# @since 0.9.0
|
411
444
|
def self.coverage
|
445
|
+
Crayons.spinner_start("Generating UVM functional coverage report...")
|
446
|
+
|
412
447
|
cmd = "xcrg -report_format html -dir xsim.covdb"
|
413
|
-
|
448
|
+
Crayons.spinner_pause
|
449
|
+
exit = execute(cmd)
|
450
|
+
Crayons.spinner_resume
|
451
|
+
Crayons.spinner_stop(nil, exit)
|
414
452
|
end
|
415
453
|
|
416
454
|
# Opens last generated functional coverage report in a HTML dashboard.
|
@@ -421,6 +459,8 @@ module Rvvm
|
|
421
459
|
def self.cov_report
|
422
460
|
Dir.chdir("xcrg_func_cov_report")
|
423
461
|
execute("./dashboard.html")
|
462
|
+
|
463
|
+
exit(0)
|
424
464
|
end
|
425
465
|
|
426
466
|
# Generates a SystemVerilog module/interface template.
|
@@ -431,19 +471,30 @@ module Rvvm
|
|
431
471
|
# @return [void]
|
432
472
|
#
|
433
473
|
# @since 0.9.0
|
434
|
-
def self.create_module(
|
474
|
+
def self.create_module(name, type)
|
435
475
|
conf = @templates[:module][:conf]
|
436
476
|
conf[:module] = name
|
437
477
|
conf[:date] = @formatted_time
|
438
|
-
|
439
|
-
|
478
|
+
unless @args[:here]
|
479
|
+
conf[:prjname] = @config[:project][:name]
|
480
|
+
conf[:company] = @config[:project][:company]
|
481
|
+
end
|
440
482
|
|
441
483
|
conf[:type] = type
|
442
484
|
@templates[:module][:file][:path] = "design/itf" if type == "itf"
|
443
|
-
|
485
|
+
|
486
|
+
if @args[:here]
|
487
|
+
path = "."
|
488
|
+
else
|
489
|
+
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
490
|
+
end
|
444
491
|
conf[:username] = Utils.git_userame || " "
|
445
492
|
|
493
|
+
puts ""
|
494
|
+
Crayons.spinner_start("Generating SV #{type} template...")
|
446
495
|
Utils.gen_template(@templates[:module], "#{name}.sv", conf, path)
|
496
|
+
Crayons.spinner_stop(nil, true)
|
497
|
+
puts ""
|
447
498
|
|
448
499
|
exit(0)
|
449
500
|
end
|
@@ -460,13 +511,23 @@ module Rvvm
|
|
460
511
|
conf[:package] = name
|
461
512
|
conf[:PACKAGE] = name.upcase
|
462
513
|
conf[:date] = @formatted_time
|
463
|
-
|
464
|
-
|
514
|
+
unless @args[:here]
|
515
|
+
conf[:prjname] = @config[:project][:name]
|
516
|
+
conf[:company] = @config[:project][:company]
|
517
|
+
end
|
465
518
|
conf[:username] = Utils.git_userame || " "
|
466
519
|
|
467
|
-
|
520
|
+
if @args[:here]
|
521
|
+
path = "."
|
522
|
+
else
|
523
|
+
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
524
|
+
end
|
468
525
|
|
526
|
+
puts ""
|
527
|
+
Crayons.spinner_start("Generating SV pkg template...")
|
469
528
|
Utils.gen_template(@templates[:package], "#{name}.sv", conf, path)
|
529
|
+
Crayons.spinner_stop(nil, true)
|
530
|
+
puts ""
|
470
531
|
|
471
532
|
exit(0)
|
472
533
|
end
|
@@ -482,13 +543,23 @@ module Rvvm
|
|
482
543
|
conf = @templates[:svfile][:conf]
|
483
544
|
conf[:NAME] = name.upcase
|
484
545
|
conf[:date] = @formatted_time
|
485
|
-
|
486
|
-
|
546
|
+
unless @args[:here]
|
547
|
+
conf[:prjname] = @config[:project][:name] || " "
|
548
|
+
conf[:company] = @config[:project][:company] || " "
|
549
|
+
end
|
487
550
|
conf[:username] = Utils.git_userame || ""
|
488
551
|
|
489
|
-
|
552
|
+
if @args[:here]
|
553
|
+
path = "."
|
554
|
+
else
|
555
|
+
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
556
|
+
end
|
490
557
|
|
558
|
+
puts ""
|
559
|
+
Crayons.spinner_start("Generating generic SV file template...")
|
491
560
|
Utils.gen_template(@templates[:svfile], "#{name}.sv", conf, path)
|
561
|
+
Crayons.spinner_stop(nil, true)
|
562
|
+
puts ""
|
492
563
|
|
493
564
|
exit(0)
|
494
565
|
end
|
@@ -502,13 +573,15 @@ module Rvvm
|
|
502
573
|
create_new_project(@args[:new]) if @args[:new]
|
503
574
|
|
504
575
|
check_args
|
505
|
-
|
506
|
-
|
576
|
+
unless @args[:here]
|
577
|
+
load_config
|
578
|
+
handle_args
|
579
|
+
end
|
507
580
|
|
508
|
-
create_module(@args[:module],
|
509
|
-
create_module(@args[:itf, "itf"
|
510
|
-
create_pkg(@args[:pkg])
|
511
|
-
create_svfile(@args[:svfile])
|
581
|
+
create_module(@args[:module], "module") if @args[:module]
|
582
|
+
create_module(@args[:itf], "itf") if @args[:itf]
|
583
|
+
create_pkg(@args[:pkg]) if @args[:pkg]
|
584
|
+
create_svfile(@args[:svfile]) if @args[:svfile]
|
512
585
|
|
513
586
|
prj_top
|
514
587
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rvvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrbya
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- bin/sandbox
|
30
30
|
- exe/rvvm
|
31
31
|
- lib/rvvm.rb
|
32
|
+
- lib/rvvm/crayons.rb
|
32
33
|
- lib/rvvm/templates.rb
|
33
34
|
- lib/rvvm/utils.rb
|
34
35
|
- lib/rvvm/version.rb
|