rvvm 0.9.5 → 1.0.1
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 +24 -0
- data/lib/rvvm/crayons.rb +134 -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 +130 -59
- metadata +45 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0658be412bda5c88fecb1bb022492703865072a78aa90acfe2e055cade7dab0d'
|
4
|
+
data.tar.gz: 8ff7f78d83a3af1c2e4c782be45cca46cb3a2a41cd7db86e91ee37ec991f599b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8529ec4e33507e4a26327b96630db95b0782e9d5f344a62d194828601356b19dc0507f4f777b6bfe4b42198cc25ca7cca274ee994b607832d0f5eafea41b6c51
|
7
|
+
data.tar.gz: 979591d920e12ae3e2bc0e112c887049177319c6d58aaef6b4b6b4343ac26029da797c834ccbce9ea892e67fb4018a508409ef88279cd81fd037e3d40fc530db
|
data/CHANGELOG.md
CHANGED
@@ -129,3 +129,27 @@
|
|
129
129
|
3. Elaboration and simulation custom waveform trace dump file
|
130
130
|
4. Project template files regeneration/restoration to default
|
131
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
|
148
|
+
|
149
|
+
## [1.0.1] - 2024-09-17
|
150
|
+
|
151
|
+
### Fixed:
|
152
|
+
|
153
|
+
1. Missing gemspec dependencies
|
154
|
+
2. Minor spinner rendering bugs
|
155
|
+
|
data/lib/rvvm/crayons.rb
ADDED
@@ -0,0 +1,134 @@
|
|
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
|
+
print "\r\e[K"
|
49
|
+
@spinner = TTY::Spinner.new("[:spinner] #{message}")
|
50
|
+
@spinner_running = true
|
51
|
+
@thread = Thread.new do
|
52
|
+
@spinner.auto_spin
|
53
|
+
sleep(0.1) while @thread_paused
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Pauses spinner thread execution to enable uninterrupted stdout outputs.
|
58
|
+
#
|
59
|
+
# @return [void]
|
60
|
+
#
|
61
|
+
# @since 1.0.0
|
62
|
+
def self.spinner_pause
|
63
|
+
return unless @spinner_running
|
64
|
+
|
65
|
+
sleep(0.1)
|
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
|
+
@spinner_running = false
|
94
|
+
print "\r\e[K"
|
95
|
+
end
|
96
|
+
|
97
|
+
# Logs a message during spinner execution removing the need
|
98
|
+
# to manually pause and resume spinner.
|
99
|
+
#
|
100
|
+
# If a spinner is not running simply prints message.
|
101
|
+
#
|
102
|
+
# @param message [String] message to prin
|
103
|
+
#
|
104
|
+
# @return [void]
|
105
|
+
#
|
106
|
+
# @since 1.0.0
|
107
|
+
def self.spinner_log(message)
|
108
|
+
spinner_pause if @spinner_running
|
109
|
+
puts message
|
110
|
+
spinner_resume if @spinner_running
|
111
|
+
end
|
112
|
+
|
113
|
+
# Logs a green text message to stdout.
|
114
|
+
#
|
115
|
+
# @param message [String] message to print
|
116
|
+
#
|
117
|
+
# @return [void]
|
118
|
+
#
|
119
|
+
# @since 1.0.0
|
120
|
+
def self.log_pass(message)
|
121
|
+
puts message.green
|
122
|
+
end
|
123
|
+
|
124
|
+
# Logs a red text message to stdout.
|
125
|
+
#
|
126
|
+
# @param message [String] message to print
|
127
|
+
#
|
128
|
+
# @return [void]
|
129
|
+
#
|
130
|
+
# @since 1.0.0
|
131
|
+
def self.log_error(message)
|
132
|
+
puts message.red
|
133
|
+
end
|
134
|
+
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,21 @@ 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_log("\n")
|
251
|
+
Crayons.spinner_stop("Done!", true)
|
252
|
+
Crayons.log_pass("\nRVvM: New project generated. ^^\n\n")
|
245
253
|
|
246
254
|
exit(0)
|
247
255
|
rescue StandardError => e
|
248
|
-
|
256
|
+
Crayons.spinner_stop("Error!", false) if Crayons.spinner_running?
|
257
|
+
Crayons.log_error("RVvM failed to create project...\n\n#{e.message}\n")
|
249
258
|
exit(1)
|
250
259
|
end
|
251
260
|
|
@@ -256,14 +265,15 @@ module Rvvm
|
|
256
265
|
#
|
257
266
|
# @since 0.8.0
|
258
267
|
def self.load_config
|
259
|
-
puts "
|
268
|
+
puts ""
|
269
|
+
Crayons.spinner_start("Loading RVvM project config...")
|
260
270
|
|
261
271
|
@config_path = Utils.find_file_dir("rvvmconf.json", ".")
|
262
272
|
json_file = File.read("#{@config_path}/rvvmconf.json") if @config_path
|
263
273
|
|
264
274
|
unless json_file
|
265
|
-
|
266
|
-
|
275
|
+
Crayons.log_error(" Failed to load config file!\n")
|
276
|
+
Crayons.log_error(" Make sure you are inside an RVvM project.\n\n")
|
267
277
|
exit(1)
|
268
278
|
end
|
269
279
|
|
@@ -274,8 +284,11 @@ module Rvvm
|
|
274
284
|
v.transform_keys(&:to_sym) if v.instance_of?(Hash)
|
275
285
|
end.transform_keys(&:to_sym)
|
276
286
|
end
|
287
|
+
|
288
|
+
Crayons.spinner_stop(nil, true)
|
289
|
+
puts ""
|
277
290
|
rescue JSON::ParserError => e
|
278
|
-
|
291
|
+
Crayons.log_error(" Invalid config json!\n\n#{e.message}")
|
279
292
|
exit(1)
|
280
293
|
end
|
281
294
|
|
@@ -298,10 +311,14 @@ module Rvvm
|
|
298
311
|
logname = @args[:complog] || File.join([@config[:project][:logDir], @config[:compilation][:logDir], @config[:compilation][:log]])
|
299
312
|
complist = @args[:compilelist] || @config[:compilation][:list]
|
300
313
|
|
301
|
-
|
314
|
+
Crayons.spinner_start("Compiling HDL sources...")
|
302
315
|
|
303
316
|
cmd = "xvlog -sv -f #{complist} -log #{logname} #{cmd_args}"
|
304
|
-
|
317
|
+
Crayons.spinner_pause
|
318
|
+
exit = execute(cmd)
|
319
|
+
Crayons.spinner_resume
|
320
|
+
Crayons.spinner_stop(nil, exit)
|
321
|
+
puts ""
|
305
322
|
end
|
306
323
|
|
307
324
|
# Compiles C/C++ sources into a shared library to use during
|
@@ -314,10 +331,12 @@ module Rvvm
|
|
314
331
|
cmd_args = @config[:dpi][:args]
|
315
332
|
dpilist = @args[:dpilist] || @config[:dpi][:list]
|
316
333
|
|
317
|
-
|
334
|
+
Crayons.spinner_start("Building DPI-C library...")
|
318
335
|
|
319
336
|
cmd = "sxc -f #{dpilist} #{cmd_args}"
|
320
|
-
execute(cmd)
|
337
|
+
exit = execute(cmd)
|
338
|
+
Crayons.spinner_stop(nil, exit)
|
339
|
+
puts ""
|
321
340
|
end
|
322
341
|
|
323
342
|
# Elaborates project into a testbench snapshot using xelab.
|
@@ -334,12 +353,14 @@ module Rvvm
|
|
334
353
|
tb = @args[:tb] || @config[:elaboration][:tb]
|
335
354
|
timescale = @args[:timescale] || @config[:elaboration][:timescale]
|
336
355
|
|
337
|
-
|
338
|
-
puts " TB TOP: \t#{tb_top}"
|
339
|
-
puts " SNAPSHOT:\t#{tb}\n"
|
356
|
+
Crayons.spinner_start("Elaborating testbench: #{tb}...")
|
340
357
|
|
341
358
|
cmd = "xelab #{tb_top} -relax -s #{tb} -timescale #{timescale} -log #{logname} #{cmd_args}"
|
342
|
-
|
359
|
+
Crayons.spinner_pause
|
360
|
+
exit = execute(cmd)
|
361
|
+
Crayons.spinner_resume
|
362
|
+
Crayons.spinner_stop(nil, exit)
|
363
|
+
puts ""
|
343
364
|
end
|
344
365
|
|
345
366
|
# Runs UVM test simulation on an elaborated testbench snapshot using xrun.
|
@@ -354,7 +375,7 @@ module Rvvm
|
|
354
375
|
else
|
355
376
|
cmd_args << "-R"
|
356
377
|
end
|
357
|
-
|
378
|
+
|
358
379
|
# Run simulaton on an array of tests.
|
359
380
|
# If in not running in batch mode testlist is an array with a single test
|
360
381
|
test = @args[:test] || @config[:simulation][:defTest]
|
@@ -363,10 +384,10 @@ module Rvvm
|
|
363
384
|
|
364
385
|
tb = @args[:simtb] || @args[:tb] || @config[:elaboration][:tb]
|
365
386
|
|
366
|
-
puts ""
|
367
|
-
|
368
387
|
testlist.each_with_index do |simtest, i|
|
369
|
-
|
388
|
+
simtest.strip!
|
389
|
+
puts "" if i.positive?
|
390
|
+
Crayons.spinner_start("Running test #{i + 1}/#{testlist.size}: #{simtest}...")
|
370
391
|
|
371
392
|
logname = File.join([@config[:project][:logDir], @config[:simulation][:logDir], @config[:simulation][:log]])
|
372
393
|
logname = Utils.interpolate(logname, { testname: simtest })
|
@@ -374,8 +395,13 @@ module Rvvm
|
|
374
395
|
verb = "UVM_#{@args[:verb] || @config[:simulation][:verbosity]}"
|
375
396
|
|
376
397
|
cmd = "xsim #{tb} -log #{logname} -testplusarg \"UVM_VERBOSITY=#{verb}\" -testplusarg \"UVM_TESTNAME=#{simtest}\" #{cmd_args}"
|
377
|
-
|
398
|
+
Crayons.spinner_pause
|
399
|
+
exit = execute(cmd)
|
400
|
+
Crayons.spinner_resume
|
401
|
+
Crayons.spinner_stop(nil, exit)
|
378
402
|
end
|
403
|
+
|
404
|
+
puts ""
|
379
405
|
end
|
380
406
|
|
381
407
|
# Runs a pure SystemVerilog/Verilog simulation using xrun.
|
@@ -387,13 +413,16 @@ module Rvvm
|
|
387
413
|
cmd_args = @config[:simulation][:args]
|
388
414
|
tb = @args[:simtb] || @args[:tb] || @config[:elaboration][:tb]
|
389
415
|
|
390
|
-
|
416
|
+
Crayons.spinner_start("Running pure SV/V simulation...")
|
391
417
|
logname = @args[:simlog] || File.join([@config[:project][:logDir], @config[:simulation][:logDir], "svsim.log"])
|
392
418
|
|
393
419
|
cmd = "xsim #{tb} -log #{logname} #{cmd_args}"
|
394
|
-
|
420
|
+
Crayons.spinner_pause
|
421
|
+
exit = execute(cmd)
|
422
|
+
Crayons.spinner_resume
|
423
|
+
Crayons.spinner_stop(nil, exit)
|
395
424
|
end
|
396
|
-
|
425
|
+
|
397
426
|
# Opens last generated waveform trace dump to inspect in Vivado GUI.
|
398
427
|
#
|
399
428
|
# @return [void]
|
@@ -404,6 +433,8 @@ module Rvvm
|
|
404
433
|
|
405
434
|
cmd = "xsim --gui #{dump}"
|
406
435
|
execute(cmd)
|
436
|
+
|
437
|
+
exit(0)
|
407
438
|
end
|
408
439
|
|
409
440
|
# Generates UVM test functional coverage report using xcrg.
|
@@ -412,8 +443,13 @@ module Rvvm
|
|
412
443
|
#
|
413
444
|
# @since 0.9.0
|
414
445
|
def self.coverage
|
446
|
+
Crayons.spinner_start("Generating UVM functional coverage report...")
|
447
|
+
|
415
448
|
cmd = "xcrg -report_format html -dir xsim.covdb"
|
416
|
-
|
449
|
+
Crayons.spinner_pause
|
450
|
+
exit = execute(cmd)
|
451
|
+
Crayons.spinner_resume
|
452
|
+
Crayons.spinner_stop(nil, exit)
|
417
453
|
end
|
418
454
|
|
419
455
|
# Opens last generated functional coverage report in a HTML dashboard.
|
@@ -424,6 +460,8 @@ module Rvvm
|
|
424
460
|
def self.cov_report
|
425
461
|
Dir.chdir("xcrg_func_cov_report")
|
426
462
|
execute("./dashboard.html")
|
463
|
+
|
464
|
+
exit(0)
|
427
465
|
end
|
428
466
|
|
429
467
|
# Generates a SystemVerilog module/interface template.
|
@@ -434,19 +472,30 @@ module Rvvm
|
|
434
472
|
# @return [void]
|
435
473
|
#
|
436
474
|
# @since 0.9.0
|
437
|
-
def self.create_module(
|
475
|
+
def self.create_module(name, type)
|
438
476
|
conf = @templates[:module][:conf]
|
439
477
|
conf[:module] = name
|
440
478
|
conf[:date] = @formatted_time
|
441
|
-
|
442
|
-
|
479
|
+
unless @args[:here]
|
480
|
+
conf[:prjname] = @config[:project][:name]
|
481
|
+
conf[:company] = @config[:project][:company]
|
482
|
+
end
|
443
483
|
|
444
484
|
conf[:type] = type
|
445
485
|
@templates[:module][:file][:path] = "design/itf" if type == "itf"
|
446
|
-
|
486
|
+
|
487
|
+
if @args[:here]
|
488
|
+
path = "."
|
489
|
+
else
|
490
|
+
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
491
|
+
end
|
447
492
|
conf[:username] = Utils.git_userame || " "
|
448
493
|
|
494
|
+
puts ""
|
495
|
+
Crayons.spinner_start("Generating SV #{type} template...")
|
449
496
|
Utils.gen_template(@templates[:module], "#{name}.sv", conf, path)
|
497
|
+
Crayons.spinner_stop(nil, true)
|
498
|
+
puts ""
|
450
499
|
|
451
500
|
exit(0)
|
452
501
|
end
|
@@ -463,13 +512,23 @@ module Rvvm
|
|
463
512
|
conf[:package] = name
|
464
513
|
conf[:PACKAGE] = name.upcase
|
465
514
|
conf[:date] = @formatted_time
|
466
|
-
|
467
|
-
|
515
|
+
unless @args[:here]
|
516
|
+
conf[:prjname] = @config[:project][:name]
|
517
|
+
conf[:company] = @config[:project][:company]
|
518
|
+
end
|
468
519
|
conf[:username] = Utils.git_userame || " "
|
469
520
|
|
470
|
-
|
521
|
+
if @args[:here]
|
522
|
+
path = "."
|
523
|
+
else
|
524
|
+
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
525
|
+
end
|
471
526
|
|
527
|
+
puts ""
|
528
|
+
Crayons.spinner_start("Generating SV pkg template...")
|
472
529
|
Utils.gen_template(@templates[:package], "#{name}.sv", conf, path)
|
530
|
+
Crayons.spinner_stop(nil, true)
|
531
|
+
puts ""
|
473
532
|
|
474
533
|
exit(0)
|
475
534
|
end
|
@@ -485,13 +544,23 @@ module Rvvm
|
|
485
544
|
conf = @templates[:svfile][:conf]
|
486
545
|
conf[:NAME] = name.upcase
|
487
546
|
conf[:date] = @formatted_time
|
488
|
-
|
489
|
-
|
547
|
+
unless @args[:here]
|
548
|
+
conf[:prjname] = @config[:project][:name] || " "
|
549
|
+
conf[:company] = @config[:project][:company] || " "
|
550
|
+
end
|
490
551
|
conf[:username] = Utils.git_userame || ""
|
491
552
|
|
492
|
-
|
553
|
+
if @args[:here]
|
554
|
+
path = "."
|
555
|
+
else
|
556
|
+
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
557
|
+
end
|
493
558
|
|
559
|
+
puts ""
|
560
|
+
Crayons.spinner_start("Generating generic SV file template...")
|
494
561
|
Utils.gen_template(@templates[:svfile], "#{name}.sv", conf, path)
|
562
|
+
Crayons.spinner_stop(nil, true)
|
563
|
+
puts ""
|
495
564
|
|
496
565
|
exit(0)
|
497
566
|
end
|
@@ -505,13 +574,15 @@ module Rvvm
|
|
505
574
|
create_new_project(@args[:new]) if @args[:new]
|
506
575
|
|
507
576
|
check_args
|
508
|
-
|
509
|
-
|
577
|
+
unless @args[:here]
|
578
|
+
load_config
|
579
|
+
handle_args
|
580
|
+
end
|
510
581
|
|
511
|
-
create_module(@args[:module],
|
512
|
-
create_module(@args[:itf, "itf"
|
513
|
-
create_pkg(@args[:pkg])
|
514
|
-
create_svfile(@args[:svfile])
|
582
|
+
create_module(@args[:module], "module") if @args[:module]
|
583
|
+
create_module(@args[:itf], "itf") if @args[:itf]
|
584
|
+
create_pkg(@args[:pkg]) if @args[:pkg]
|
585
|
+
create_svfile(@args[:svfile]) if @args[:svfile]
|
515
586
|
|
516
587
|
prj_top
|
517
588
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrbya
|
@@ -9,7 +9,49 @@ autorequire:
|
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-09-17 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.16'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rainbow
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tty-spinner
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.3
|
13
55
|
description: RVvM is a Ruby based meta tool to manage/compile/elaborate and run simulations
|
14
56
|
on SystemVerilog and UVM based projects using Xilinx Vivado xvlog, xelab, xrun,
|
15
57
|
xsc tools
|
@@ -29,6 +71,7 @@ files:
|
|
29
71
|
- bin/sandbox
|
30
72
|
- exe/rvvm
|
31
73
|
- lib/rvvm.rb
|
74
|
+
- lib/rvvm/crayons.rb
|
32
75
|
- lib/rvvm/templates.rb
|
33
76
|
- lib/rvvm/utils.rb
|
34
77
|
- lib/rvvm/version.rb
|