rvvm 1.0.0 → 1.1.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 +26 -0
- data/lib/rvvm/crayons.rb +42 -5
- data/lib/rvvm/version.rb +1 -1
- data/lib/rvvm.rb +22 -50
- data/sig/rvvm/crayons.rbs +17 -0
- data/sig/rvvm/utils.rbs +15 -0
- data/sig/rvvm.rbs +10 -1
- metadata +47 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 420096b77b4d823c6ad6a69509ffe6da56d4a63cf96152cd7d36a5ea41ab063a
|
4
|
+
data.tar.gz: 28b2c65e701d7f2bdfdb3b7bac2d0d7a9f62db9877d912d18eaa9a8e8d9aac78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2cb584479a4fde2453c4d4830403db857d2dc197840dc44dd2b9b932881e111abea00fbad1ba52e7c2e01e4865b66911f12eef5110bdadb695a468df293aeb8
|
7
|
+
data.tar.gz: eea11a1a5f36f0a20d796dd87e165f7618b022c8062c81b0eb45122644a5291adcbd475973df785008bc3e43be866b3b78830bcb3c666636b17a03b138cde830
|
data/CHANGELOG.md
CHANGED
@@ -145,3 +145,29 @@
|
|
145
145
|
|
146
146
|
1. Elaboration and simulation custom waveform trace dump file
|
147
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
|
+
|
156
|
+
## TBI:
|
157
|
+
|
158
|
+
1. Elaboration and simulation custom waveform trace dump file
|
159
|
+
2. Project template files regeneration/restoration to default
|
160
|
+
3. Crayon module tests
|
161
|
+
4. RBS definitions
|
162
|
+
|
163
|
+
## [1.1.0] - 2024-09-18
|
164
|
+
|
165
|
+
### Added:
|
166
|
+
|
167
|
+
1. Crayon.command to execute shell commands with spinners
|
168
|
+
2. Crayon module tests
|
169
|
+
3. RBS definitions
|
170
|
+
|
171
|
+
### Fixed:
|
172
|
+
|
173
|
+
1. More Crayons rendering bugs
|
data/lib/rvvm/crayons.rb
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "tty-spinner"
|
4
|
+
require "tty-command"
|
4
5
|
require "rainbow/refinement"
|
5
6
|
|
6
7
|
using Rainbow
|
7
8
|
|
8
|
-
# Utility module providing
|
9
|
+
# Utility module providing an API to run shell commands
|
10
|
+
# with spinners and stdout mesage formatting.
|
9
11
|
#
|
10
12
|
# @example
|
11
13
|
# require 'rvvm/crayons'
|
12
14
|
#
|
15
|
+
# Crayons.init
|
16
|
+
#
|
17
|
+
# # Runn a shell command with a spinner
|
18
|
+
# Crayons.command("Running command...", "ls -aln")
|
19
|
+
#
|
20
|
+
# # Run custom code with a spinner
|
13
21
|
# Crayons.spinner_start("New task...")
|
14
22
|
#
|
15
23
|
# # do stuff
|
@@ -29,6 +37,16 @@ module Crayons
|
|
29
37
|
@thread = nil
|
30
38
|
@thread_paused = false
|
31
39
|
@spinner_running = false
|
40
|
+
@command = nil
|
41
|
+
|
42
|
+
# Initializes Crayons module.
|
43
|
+
#
|
44
|
+
# @return [void]
|
45
|
+
#
|
46
|
+
# @since 1.1.0
|
47
|
+
def self.init
|
48
|
+
@command = TTY::Command.new(printer: :null)
|
49
|
+
end
|
32
50
|
|
33
51
|
# Returns spinner status.
|
34
52
|
#
|
@@ -45,13 +63,15 @@ module Crayons
|
|
45
63
|
#
|
46
64
|
# @since 1.0.0
|
47
65
|
def self.spinner_start(message)
|
48
|
-
sleep(0.1)
|
49
66
|
print "\r\e[K"
|
50
|
-
@spinner = TTY::Spinner.new("[:spinner] #{message}")
|
67
|
+
@spinner = TTY::Spinner.new("[:spinner] #{message}", interval: 5)
|
51
68
|
@spinner_running = true
|
52
69
|
@thread = Thread.new do
|
53
70
|
@spinner.auto_spin
|
54
|
-
|
71
|
+
while @thread_sleeping
|
72
|
+
print "\r\e[K"
|
73
|
+
sleep(0.1)
|
74
|
+
end
|
55
75
|
end
|
56
76
|
end
|
57
77
|
|
@@ -65,6 +85,8 @@ module Crayons
|
|
65
85
|
|
66
86
|
print "\r\e[K"
|
67
87
|
@thread_paused = true
|
88
|
+
sleep(0.1)
|
89
|
+
print "\r\e[K"
|
68
90
|
end
|
69
91
|
|
70
92
|
# Resumes spinner thread execution.
|
@@ -90,7 +112,6 @@ module Crayons
|
|
90
112
|
spinner_message = message || (exit ? "Done!" : "Failed!")
|
91
113
|
exit ? @spinner.success(spinner_message.green) : @spinner.error(spinner_message.red)
|
92
114
|
@thread.join
|
93
|
-
sleep(0.1)
|
94
115
|
@spinner_running = false
|
95
116
|
print "\r\e[K"
|
96
117
|
end
|
@@ -111,6 +132,22 @@ module Crayons
|
|
111
132
|
spinner_resume if @spinner_running
|
112
133
|
end
|
113
134
|
|
135
|
+
# Runs a shell command with a spinner.
|
136
|
+
#
|
137
|
+
# @param tag [String] spinner tag
|
138
|
+
# @param cmd [String] shell command to be run
|
139
|
+
#
|
140
|
+
# @return [void]
|
141
|
+
#
|
142
|
+
# @since 1.1.0
|
143
|
+
def self.command(tag, cmd)
|
144
|
+
spinner_start(tag)
|
145
|
+
out = @command.run!(cmd)
|
146
|
+
spinner_log("#{out.out}\n")
|
147
|
+
spinner_stop(nil, out.success?)
|
148
|
+
puts ""
|
149
|
+
end
|
150
|
+
|
114
151
|
# Logs a green text message to stdout.
|
115
152
|
#
|
116
153
|
# @param message [String] message to print
|
data/lib/rvvm/version.rb
CHANGED
data/lib/rvvm.rb
CHANGED
@@ -55,6 +55,7 @@ module Rvvm
|
|
55
55
|
OptionParser.new do |args|
|
56
56
|
current_time = Time.now
|
57
57
|
@formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
|
58
|
+
Crayons.init
|
58
59
|
|
59
60
|
args.on("-h", "--help", "Shows this help") do
|
60
61
|
puts "\nRVvM - Ruby Vivado Manager\n\n"
|
@@ -161,12 +162,14 @@ module Rvvm
|
|
161
162
|
# @return [void]
|
162
163
|
#
|
163
164
|
# @since 0.8.0
|
164
|
-
def self.execute(command)
|
165
|
+
def self.execute(tag, command)
|
165
166
|
if @args[:debug]
|
166
|
-
|
167
|
+
puts command
|
168
|
+
Crayons.spinner_start(tag)
|
167
169
|
sleep(1)
|
170
|
+
Crayons.spinner_stop(nil, true)
|
168
171
|
else
|
169
|
-
|
172
|
+
Crayons.command(tag, command)
|
170
173
|
end
|
171
174
|
end
|
172
175
|
|
@@ -247,6 +250,7 @@ module Rvvm
|
|
247
250
|
system('git commit -am "Initial commit"')
|
248
251
|
Crayons.spinner_resume
|
249
252
|
|
253
|
+
Crayons.spinner_log("")
|
250
254
|
Crayons.spinner_stop("Done!", true)
|
251
255
|
Crayons.log_pass("\nRVvM: New project generated. ^^\n\n")
|
252
256
|
|
@@ -288,6 +292,7 @@ module Rvvm
|
|
288
292
|
puts ""
|
289
293
|
rescue JSON::ParserError => e
|
290
294
|
Crayons.log_error(" Invalid config json!\n\n#{e.message}")
|
295
|
+
puts""
|
291
296
|
exit(1)
|
292
297
|
end
|
293
298
|
|
@@ -306,18 +311,12 @@ module Rvvm
|
|
306
311
|
#
|
307
312
|
# @since 0.8.0
|
308
313
|
def self.compile
|
309
|
-
cmd_args = @config[:compilation][:args]
|
314
|
+
cmd_args = @config[:compilation][:args].strip
|
310
315
|
logname = @args[:complog] || File.join([@config[:project][:logDir], @config[:compilation][:logDir], @config[:compilation][:log]])
|
311
316
|
complist = @args[:compilelist] || @config[:compilation][:list]
|
312
317
|
|
313
|
-
Crayons.spinner_start("Compiling HDL sources...")
|
314
|
-
|
315
318
|
cmd = "xvlog -sv -f #{complist} -log #{logname} #{cmd_args}"
|
316
|
-
|
317
|
-
exit = execute(cmd)
|
318
|
-
Crayons.spinner_resume
|
319
|
-
Crayons.spinner_stop(nil, exit)
|
320
|
-
puts ""
|
319
|
+
execute("Compiling HDL sources...", cmd)
|
321
320
|
end
|
322
321
|
|
323
322
|
# Compiles C/C++ sources into a shared library to use during
|
@@ -327,15 +326,11 @@ module Rvvm
|
|
327
326
|
#
|
328
327
|
# @Since 0.9.0
|
329
328
|
def self.dpi_c
|
330
|
-
cmd_args = @config[:dpi][:args]
|
329
|
+
cmd_args = @config[:dpi][:args].strip
|
331
330
|
dpilist = @args[:dpilist] || @config[:dpi][:list]
|
332
331
|
|
333
|
-
Crayons.spinner_start("Building DPI-C library...")
|
334
|
-
|
335
332
|
cmd = "sxc -f #{dpilist} #{cmd_args}"
|
336
|
-
|
337
|
-
Crayons.spinner_stop(nil, exit)
|
338
|
-
puts ""
|
333
|
+
execute("Building DPI-C library...", cmd)
|
339
334
|
end
|
340
335
|
|
341
336
|
# Elaborates project into a testbench snapshot using xelab.
|
@@ -347,19 +342,14 @@ module Rvvm
|
|
347
342
|
cmd_args = @config[:elaboration][:args]
|
348
343
|
cmd_args << " -sv_lib dpi" if @args[:dpi] || @args[:dpilib] || @config[:dpi][:dpilib] == 1
|
349
344
|
cmd_args << " -debug wave" if @args[:wave]
|
345
|
+
cmd_args.strip!
|
350
346
|
logname = @args[:elablog] || File.join([@config[:project][:logDir], @config[:elaboration][:logDir], @config[:elaboration][:log]])
|
351
347
|
tb_top = @args[:tbtop] || @config[:elaboration][:tbTop]
|
352
348
|
tb = @args[:tb] || @config[:elaboration][:tb]
|
353
349
|
timescale = @args[:timescale] || @config[:elaboration][:timescale]
|
354
350
|
|
355
|
-
Crayons.spinner_start("Elaborating testbench: #{tb}...")
|
356
|
-
|
357
351
|
cmd = "xelab #{tb_top} -relax -s #{tb} -timescale #{timescale} -log #{logname} #{cmd_args}"
|
358
|
-
|
359
|
-
exit = execute(cmd)
|
360
|
-
Crayons.spinner_resume
|
361
|
-
Crayons.spinner_stop(nil, exit)
|
362
|
-
puts ""
|
352
|
+
execute("Elaborating testbench #{tb}...", cmd)
|
363
353
|
end
|
364
354
|
|
365
355
|
# Runs UVM test simulation on an elaborated testbench snapshot using xrun.
|
@@ -372,8 +362,9 @@ module Rvvm
|
|
372
362
|
if @args[:wave]
|
373
363
|
cmd_args << " --tclbatch wfcfg.tcl"
|
374
364
|
else
|
375
|
-
cmd_args << "-R"
|
365
|
+
cmd_args << " -R"
|
376
366
|
end
|
367
|
+
cmd_args.strip!
|
377
368
|
|
378
369
|
# Run simulaton on an array of tests.
|
379
370
|
# If in not running in batch mode testlist is an array with a single test
|
@@ -385,8 +376,6 @@ module Rvvm
|
|
385
376
|
|
386
377
|
testlist.each_with_index do |simtest, i|
|
387
378
|
simtest.strip!
|
388
|
-
puts "" if i.positive?
|
389
|
-
Crayons.spinner_start("Running test #{i + 1}/#{testlist.size}: #{simtest}...")
|
390
379
|
|
391
380
|
logname = File.join([@config[:project][:logDir], @config[:simulation][:logDir], @config[:simulation][:log]])
|
392
381
|
logname = Utils.interpolate(logname, { testname: simtest })
|
@@ -394,13 +383,8 @@ module Rvvm
|
|
394
383
|
verb = "UVM_#{@args[:verb] || @config[:simulation][:verbosity]}"
|
395
384
|
|
396
385
|
cmd = "xsim #{tb} -log #{logname} -testplusarg \"UVM_VERBOSITY=#{verb}\" -testplusarg \"UVM_TESTNAME=#{simtest}\" #{cmd_args}"
|
397
|
-
|
398
|
-
exit = execute(cmd)
|
399
|
-
Crayons.spinner_resume
|
400
|
-
Crayons.spinner_stop(nil, exit)
|
386
|
+
execute("Running UVM test #{i + 1}/#{testlist.size}: #{simtest}...", cmd)
|
401
387
|
end
|
402
|
-
|
403
|
-
puts ""
|
404
388
|
end
|
405
389
|
|
406
390
|
# Runs a pure SystemVerilog/Verilog simulation using xrun.
|
@@ -409,17 +393,13 @@ module Rvvm
|
|
409
393
|
#
|
410
394
|
# @since 0.9.0
|
411
395
|
def self.run_sv
|
412
|
-
cmd_args = @config[:simulation][:args]
|
396
|
+
cmd_args = @config[:simulation][:args].strip!
|
413
397
|
tb = @args[:simtb] || @args[:tb] || @config[:elaboration][:tb]
|
414
398
|
|
415
|
-
Crayons.spinner_start("Running pure SV/V simulation...")
|
416
399
|
logname = @args[:simlog] || File.join([@config[:project][:logDir], @config[:simulation][:logDir], "svsim.log"])
|
417
400
|
|
418
401
|
cmd = "xsim #{tb} -log #{logname} #{cmd_args}"
|
419
|
-
|
420
|
-
exit = execute(cmd)
|
421
|
-
Crayons.spinner_resume
|
422
|
-
Crayons.spinner_stop(nil, exit)
|
402
|
+
execute("Running pure SV/V simulation...", cmd)
|
423
403
|
end
|
424
404
|
|
425
405
|
# Opens last generated waveform trace dump to inspect in Vivado GUI.
|
@@ -431,7 +411,7 @@ module Rvvm
|
|
431
411
|
dump = @args[:wavefile] || "#{@config[:elaboration][:tb]}.wdb"
|
432
412
|
|
433
413
|
cmd = "xsim --gui #{dump}"
|
434
|
-
execute(cmd)
|
414
|
+
execute("Running Vivado GUI...", cmd)
|
435
415
|
|
436
416
|
exit(0)
|
437
417
|
end
|
@@ -442,13 +422,8 @@ module Rvvm
|
|
442
422
|
#
|
443
423
|
# @since 0.9.0
|
444
424
|
def self.coverage
|
445
|
-
Crayons.spinner_start("Generating UVM functional coverage report...")
|
446
|
-
|
447
425
|
cmd = "xcrg -report_format html -dir xsim.covdb"
|
448
|
-
|
449
|
-
exit = execute(cmd)
|
450
|
-
Crayons.spinner_resume
|
451
|
-
Crayons.spinner_stop(nil, exit)
|
426
|
+
execute("Generating UVM test functional coverage report...", cmd)
|
452
427
|
end
|
453
428
|
|
454
429
|
# Opens last generated functional coverage report in a HTML dashboard.
|
@@ -458,7 +433,7 @@ module Rvvm
|
|
458
433
|
# @since 0.9.0
|
459
434
|
def self.cov_report
|
460
435
|
Dir.chdir("xcrg_func_cov_report")
|
461
|
-
execute("./dashboard.html")
|
436
|
+
execute("Opening coverage dashboard...", "./dashboard.html")
|
462
437
|
|
463
438
|
exit(0)
|
464
439
|
end
|
@@ -490,7 +465,6 @@ module Rvvm
|
|
490
465
|
end
|
491
466
|
conf[:username] = Utils.git_userame || " "
|
492
467
|
|
493
|
-
puts ""
|
494
468
|
Crayons.spinner_start("Generating SV #{type} template...")
|
495
469
|
Utils.gen_template(@templates[:module], "#{name}.sv", conf, path)
|
496
470
|
Crayons.spinner_stop(nil, true)
|
@@ -523,7 +497,6 @@ module Rvvm
|
|
523
497
|
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
524
498
|
end
|
525
499
|
|
526
|
-
puts ""
|
527
500
|
Crayons.spinner_start("Generating SV pkg template...")
|
528
501
|
Utils.gen_template(@templates[:package], "#{name}.sv", conf, path)
|
529
502
|
Crayons.spinner_stop(nil, true)
|
@@ -555,7 +528,6 @@ module Rvvm
|
|
555
528
|
path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
|
556
529
|
end
|
557
530
|
|
558
|
-
puts ""
|
559
531
|
Crayons.spinner_start("Generating generic SV file template...")
|
560
532
|
Utils.gen_template(@templates[:svfile], "#{name}.sv", conf, path)
|
561
533
|
Crayons.spinner_stop(nil, true)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Crayons
|
2
|
+
|
3
|
+
def self.spinner_running?: () -> Boolean
|
4
|
+
|
5
|
+
def self.spinner_start: (String) -> void
|
6
|
+
|
7
|
+
def self.spinner_stop: (String, Boolean) -> void
|
8
|
+
|
9
|
+
def self.spinner_log: (String) -> void
|
10
|
+
|
11
|
+
def self.command: (String, String) -> void
|
12
|
+
|
13
|
+
def self.log_pass: (String) -> void
|
14
|
+
|
15
|
+
def self.log_error: (String) -> void
|
16
|
+
|
17
|
+
end
|
data/sig/rvvm/utils.rbs
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Utils
|
2
|
+
|
3
|
+
def self.interpolate: (String, Hash) -> String
|
4
|
+
|
5
|
+
def self.gen_file: (String, String) -> void
|
6
|
+
|
7
|
+
def self.gen_template: (Hash, String, Hash, String) -> void
|
8
|
+
|
9
|
+
def self.find_file_dir: (String, String) -> String
|
10
|
+
|
11
|
+
def self.git_username: () -> String
|
12
|
+
|
13
|
+
def self.all_nil? (Hash, Array) -> Boolean
|
14
|
+
|
15
|
+
end
|
data/sig/rvvm.rbs
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
module Rvvm
|
2
2
|
VERSION: String
|
3
|
-
|
3
|
+
|
4
|
+
def self.execute: (String, String) -> void
|
5
|
+
|
6
|
+
def self.create_new_project: (String) -> void
|
7
|
+
|
8
|
+
def self.create_module: (String, String) -> void
|
9
|
+
|
10
|
+
def self.create_pkg: (String) -> void
|
11
|
+
|
12
|
+
def self.create_svfile: (String) -> void
|
4
13
|
end
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rvvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrbya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rainbow
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tty-command
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.10.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.10.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
|
@@ -34,6 +76,8 @@ files:
|
|
34
76
|
- lib/rvvm/utils.rb
|
35
77
|
- lib/rvvm/version.rb
|
36
78
|
- sig/rvvm.rbs
|
79
|
+
- sig/rvvm/crayons.rbs
|
80
|
+
- sig/rvvm/utils.rbs
|
37
81
|
homepage: https://gitlab.com/such-hdl-much-wow/rvvm.git
|
38
82
|
licenses:
|
39
83
|
- MIT
|