rvvm 0.9.5 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fd6e9e8729d0de5aeabb5a88f183096de1acc98ae8d5e2d70c7be57edf883a0
4
- data.tar.gz: aa70e5dd5f06d668c8e83a38043d02f0b86aa047bd7a85c5b4db5ce04567a894
3
+ metadata.gz: 9232781d6d02b88aa6d9442091845ad5a167046cc6149fffa4b69323dbcef3f2
4
+ data.tar.gz: b1777bfa093994e1d9e6abac38aea4e286fb13099a9f1fdb1ad4c37daeb5b134
5
5
  SHA512:
6
- metadata.gz: accdd51566d38973f742e264d35bfecdc1b5ede51d3d0f9062114a4dd8c2d95bc64437026123de630ed2a1ce7b9702cb06d1e4570820cbadf89f946aa9641f22
7
- data.tar.gz: a330ed820c00511ced53ffe42ec13d2eec98d9783c3aa581a144a029e46b4a92ed84fd86a27b5c25dc46b83c1f88d9cf8ab2ac0e37e688215713a16ce7bf9e17
6
+ metadata.gz: a3a0253c53db3ffba91ffa310b0cba9001f5b5d34efd70cdc1f85fef13e09149ed0afcf117ebec4e28d22aa1c1a31e324b963a23515a6ab52dba6423f43e5d0d
7
+ data.tar.gz: 17c5b7eb71ac667fff426a7570c8e86f98a0a3ddfbc59d034fbb24820074799cbc8cd595fa5f0666e8dc60e4edd9c992e6048497e8f0b2382ee4835689b9d878
data/CHANGELOG.md CHANGED
@@ -129,3 +129,19 @@
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
@@ -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
@@ -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: "RVvM",
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: "RVvM",
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: "RVvM",
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
- puts "\nFailed to create a file!\nError #{e.message}"
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
- puts " Generating: #{filepath}/#{filename}"
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.strip!
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
@@ -3,5 +3,5 @@
3
3
  # Module holding current rvvm version.
4
4
  module Rvvm
5
5
  # Current rvvm module version.
6
- VERSION = "0.9.5"
6
+ VERSION = "1.0.0"
7
7
  end
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
- if Utils.all_nil?(@args, @required_args)
125
- puts "\nNo required options provided!\nFor more info use -h or --help\n"
126
- exit(1)
127
- end
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
- puts command
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 " Directory #{name} already exists. Do you want to overwrite it? [y/n] "
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
- if input == "y"
184
- FileUtils.rm_rf(name)
185
- else
186
- exit(0)
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
- puts " "
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
- puts "\nRVvM: New project generated. ^^\n\n"
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
- puts "RVvM: Failed to create project...\n #{e.message}\n"
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,14 +264,15 @@ module Rvvm
256
264
  #
257
265
  # @since 0.8.0
258
266
  def self.load_config
259
- puts "\nRVvM: Loading RVvM project config..."
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
- puts " Failed to load config file!\n"
266
- puts " Make sure you are inside an RVvM project.\n\n"
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
 
@@ -274,8 +283,11 @@ module Rvvm
274
283
  v.transform_keys(&:to_sym) if v.instance_of?(Hash)
275
284
  end.transform_keys(&:to_sym)
276
285
  end
286
+
287
+ Crayons.spinner_stop(nil, true)
288
+ puts ""
277
289
  rescue JSON::ParserError => e
278
- puts " Invalid config json!\n\n#{e.message}"
290
+ Crayons.log_error(" Invalid config json!\n\n#{e.message}")
279
291
  exit(1)
280
292
  end
281
293
 
@@ -298,10 +310,14 @@ module Rvvm
298
310
  logname = @args[:complog] || File.join([@config[:project][:logDir], @config[:compilation][:logDir], @config[:compilation][:log]])
299
311
  complist = @args[:compilelist] || @config[:compilation][:list]
300
312
 
301
- puts "\nRVvM: Compiling HDL sources..\n"
313
+ Crayons.spinner_start("Compiling HDL sources...")
302
314
 
303
315
  cmd = "xvlog -sv -f #{complist} -log #{logname} #{cmd_args}"
304
- execute(cmd)
316
+ Crayons.spinner_pause
317
+ exit = execute(cmd)
318
+ Crayons.spinner_resume
319
+ Crayons.spinner_stop(nil, exit)
320
+ puts ""
305
321
  end
306
322
 
307
323
  # Compiles C/C++ sources into a shared library to use during
@@ -314,10 +330,12 @@ module Rvvm
314
330
  cmd_args = @config[:dpi][:args]
315
331
  dpilist = @args[:dpilist] || @config[:dpi][:list]
316
332
 
317
- puts "\nRVvM: Building DPI-C library...\n"
333
+ Crayons.spinner_start("Building DPI-C library...")
318
334
 
319
335
  cmd = "sxc -f #{dpilist} #{cmd_args}"
320
- execute(cmd)
336
+ exit = execute(cmd)
337
+ Crayons.spinner_stop(nil, exit)
338
+ puts ""
321
339
  end
322
340
 
323
341
  # Elaborates project into a testbench snapshot using xelab.
@@ -334,12 +352,14 @@ module Rvvm
334
352
  tb = @args[:tb] || @config[:elaboration][:tb]
335
353
  timescale = @args[:timescale] || @config[:elaboration][:timescale]
336
354
 
337
- puts "\nRVvM: Elaborating testbench:"
338
- puts " TB TOP: \t#{tb_top}"
339
- puts " SNAPSHOT:\t#{tb}\n"
355
+ Crayons.spinner_start("Elaborating testbench: #{tb}...")
340
356
 
341
357
  cmd = "xelab #{tb_top} -relax -s #{tb} -timescale #{timescale} -log #{logname} #{cmd_args}"
342
- execute(cmd)
358
+ Crayons.spinner_pause
359
+ exit = execute(cmd)
360
+ Crayons.spinner_resume
361
+ Crayons.spinner_stop(nil, exit)
362
+ puts ""
343
363
  end
344
364
 
345
365
  # Runs UVM test simulation on an elaborated testbench snapshot using xrun.
@@ -354,7 +374,7 @@ module Rvvm
354
374
  else
355
375
  cmd_args << "-R"
356
376
  end
357
-
377
+
358
378
  # Run simulaton on an array of tests.
359
379
  # If in not running in batch mode testlist is an array with a single test
360
380
  test = @args[:test] || @config[:simulation][:defTest]
@@ -363,10 +383,10 @@ module Rvvm
363
383
 
364
384
  tb = @args[:simtb] || @args[:tb] || @config[:elaboration][:tb]
365
385
 
366
- puts ""
367
-
368
386
  testlist.each_with_index do |simtest, i|
369
- puts "RVvM: Running test #{i + 1}/#{testlist.size}: #{simtest}"
387
+ simtest.strip!
388
+ puts "" if i.positive?
389
+ Crayons.spinner_start("Running test #{i + 1}/#{testlist.size}: #{simtest}...")
370
390
 
371
391
  logname = File.join([@config[:project][:logDir], @config[:simulation][:logDir], @config[:simulation][:log]])
372
392
  logname = Utils.interpolate(logname, { testname: simtest })
@@ -374,8 +394,13 @@ module Rvvm
374
394
  verb = "UVM_#{@args[:verb] || @config[:simulation][:verbosity]}"
375
395
 
376
396
  cmd = "xsim #{tb} -log #{logname} -testplusarg \"UVM_VERBOSITY=#{verb}\" -testplusarg \"UVM_TESTNAME=#{simtest}\" #{cmd_args}"
377
- execute(cmd)
397
+ Crayons.spinner_pause
398
+ exit = execute(cmd)
399
+ Crayons.spinner_resume
400
+ Crayons.spinner_stop(nil, exit)
378
401
  end
402
+
403
+ puts ""
379
404
  end
380
405
 
381
406
  # Runs a pure SystemVerilog/Verilog simulation using xrun.
@@ -387,13 +412,16 @@ module Rvvm
387
412
  cmd_args = @config[:simulation][:args]
388
413
  tb = @args[:simtb] || @args[:tb] || @config[:elaboration][:tb]
389
414
 
390
- puts "\nRVvM: Running pure SV/V simulation..."
415
+ Crayons.spinner_start("Running pure SV/V simulation...")
391
416
  logname = @args[:simlog] || File.join([@config[:project][:logDir], @config[:simulation][:logDir], "svsim.log"])
392
417
 
393
418
  cmd = "xsim #{tb} -log #{logname} #{cmd_args}"
394
- execute(cmd)
419
+ Crayons.spinner_pause
420
+ exit = execute(cmd)
421
+ Crayons.spinner_resume
422
+ Crayons.spinner_stop(nil, exit)
395
423
  end
396
-
424
+
397
425
  # Opens last generated waveform trace dump to inspect in Vivado GUI.
398
426
  #
399
427
  # @return [void]
@@ -404,6 +432,8 @@ module Rvvm
404
432
 
405
433
  cmd = "xsim --gui #{dump}"
406
434
  execute(cmd)
435
+
436
+ exit(0)
407
437
  end
408
438
 
409
439
  # Generates UVM test functional coverage report using xcrg.
@@ -412,8 +442,13 @@ module Rvvm
412
442
  #
413
443
  # @since 0.9.0
414
444
  def self.coverage
445
+ Crayons.spinner_start("Generating UVM functional coverage report...")
446
+
415
447
  cmd = "xcrg -report_format html -dir xsim.covdb"
416
- execute(cmd)
448
+ Crayons.spinner_pause
449
+ exit = execute(cmd)
450
+ Crayons.spinner_resume
451
+ Crayons.spinner_stop(nil, exit)
417
452
  end
418
453
 
419
454
  # Opens last generated functional coverage report in a HTML dashboard.
@@ -424,6 +459,8 @@ module Rvvm
424
459
  def self.cov_report
425
460
  Dir.chdir("xcrg_func_cov_report")
426
461
  execute("./dashboard.html")
462
+
463
+ exit(0)
427
464
  end
428
465
 
429
466
  # Generates a SystemVerilog module/interface template.
@@ -434,19 +471,30 @@ module Rvvm
434
471
  # @return [void]
435
472
  #
436
473
  # @since 0.9.0
437
- def self.create_module(type, name)
474
+ def self.create_module(name, type)
438
475
  conf = @templates[:module][:conf]
439
476
  conf[:module] = name
440
477
  conf[:date] = @formatted_time
441
- conf[:prjname] = @config[:project][:name]
442
- conf[:company] = @config[:project][:company]
478
+ unless @args[:here]
479
+ conf[:prjname] = @config[:project][:name]
480
+ conf[:company] = @config[:project][:company]
481
+ end
443
482
 
444
483
  conf[:type] = type
445
484
  @templates[:module][:file][:path] = "design/itf" if type == "itf"
446
- path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
485
+
486
+ if @args[:here]
487
+ path = "."
488
+ else
489
+ path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
490
+ end
447
491
  conf[:username] = Utils.git_userame || " "
448
492
 
493
+ puts ""
494
+ Crayons.spinner_start("Generating SV #{type} template...")
449
495
  Utils.gen_template(@templates[:module], "#{name}.sv", conf, path)
496
+ Crayons.spinner_stop(nil, true)
497
+ puts ""
450
498
 
451
499
  exit(0)
452
500
  end
@@ -463,13 +511,23 @@ module Rvvm
463
511
  conf[:package] = name
464
512
  conf[:PACKAGE] = name.upcase
465
513
  conf[:date] = @formatted_time
466
- conf[:prjname] = @config[:project][:name]
467
- conf[:company] = @config[:project][:company]
514
+ unless @args[:here]
515
+ conf[:prjname] = @config[:project][:name]
516
+ conf[:company] = @config[:project][:company]
517
+ end
468
518
  conf[:username] = Utils.git_userame || " "
469
519
 
470
- path = File.join([@config[:project][:path], @args[:path] || @templates[:package][:file][:path]])
520
+ if @args[:here]
521
+ path = "."
522
+ else
523
+ path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
524
+ end
471
525
 
526
+ puts ""
527
+ Crayons.spinner_start("Generating SV pkg template...")
472
528
  Utils.gen_template(@templates[:package], "#{name}.sv", conf, path)
529
+ Crayons.spinner_stop(nil, true)
530
+ puts ""
473
531
 
474
532
  exit(0)
475
533
  end
@@ -485,13 +543,23 @@ module Rvvm
485
543
  conf = @templates[:svfile][:conf]
486
544
  conf[:NAME] = name.upcase
487
545
  conf[:date] = @formatted_time
488
- conf[:prjname] = @config[:project][:name]
489
- conf[:company] = @config[:project][:company]
546
+ unless @args[:here]
547
+ conf[:prjname] = @config[:project][:name] || " "
548
+ conf[:company] = @config[:project][:company] || " "
549
+ end
490
550
  conf[:username] = Utils.git_userame || ""
491
551
 
492
- path = File.join([@config[:project][:path], @args[:path] || @templates[:package][:file][:path]])
552
+ if @args[:here]
553
+ path = "."
554
+ else
555
+ path = File.join([@config[:project][:path], @args[:path] || @templates[:module][:file][:path]])
556
+ end
493
557
 
558
+ puts ""
559
+ Crayons.spinner_start("Generating generic SV file template...")
494
560
  Utils.gen_template(@templates[:svfile], "#{name}.sv", conf, path)
561
+ Crayons.spinner_stop(nil, true)
562
+ puts ""
495
563
 
496
564
  exit(0)
497
565
  end
@@ -505,13 +573,15 @@ module Rvvm
505
573
  create_new_project(@args[:new]) if @args[:new]
506
574
 
507
575
  check_args
508
- load_config
509
- handle_args
576
+ unless @args[:here]
577
+ load_config
578
+ handle_args
579
+ end
510
580
 
511
- create_module(@args[:module], nil) if @args[:module]
512
- create_module(@args[:itf, "itf"]) if @args[:itf]
513
- create_pkg(@args[:pkg]) if @args[:pkg]
514
- create_svfile(@args[:svfile]) if @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]
515
585
 
516
586
  prj_top
517
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.9.5
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