52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/ecic/generate.rb', line 52
def design(*names)
begin
lib_name = options[:lib]
type = options[:type]
root_dir = Project::root
if root_dir.nil?
shell.error "You must be within an ECIC project before calling this command"
exit(1)
end
project = Project.new(root_dir)
project.load_libraries
unless project.has_library?(lib_name)
if yes?("Library '#{lib_name}' does not exist. Create it? [y/n]:")
generator = LibraryGenerator.new
generator.destination_root = root_dir
generator.library_name = lib_name
generator.invoke_all
else
shell.error "Operation aborted!"
exit(2)
end
end
names.each { |design_name|
incl_types_pkg = options[:types_package]
if type == 'vhdl'
incl_types_pkg = yes?("Would you like to include a package for type and constant definitions for '#{design_name}'? [y/n]: ") if incl_types_pkg.nil?
else
incl_types_pkg ||= false
if incl_types_pkg
shell.error "--types_package option does not apply for Verilog/SystemVerilog generation!"
exit(3)
end
end
if type == 'vhdl'
generator = DesignGenerator.new
generator.include_types_pkg = incl_types_pkg
elsif type == 'sv'
generator = SvDesignGenerator.new
else
shell.error "--type option must be set to either 'vhdl' or 'sv'"
exit(3)
end
generator.destination_root = root_dir
generator.library_name = lib_name
generator.design_name = design_name
generator.invoke_all
}
rescue Exception => exc
shell.error exc.message
exit(3)
end
end
|