Class: ClassHDL::SdlPackage
- Defined in:
- lib/tdl/class_hdl/hdl_package.rb
Instance Attribute Summary
Attributes inherited from SdlModule
#create_tcl, #dont_gen_sv, #ex_down_code, #ex_param, #ex_port, #ex_up_code, #head_import_packages, #instance_and_children_module, #instanced_and_parent_module, #module_name, #origin_sv, #out_sv_path, #path, #real_sv_path, #target_class, #techbench
Instance Method Summary collapse
- #build_module(ex_param: "", ex_port: "", ex_up_code: "", ex_down_code: "") ⇒ Object
- #build_params(ex_str = "") ⇒ Object
- #macro_def ⇒ Object
Methods inherited from SdlModule
#<<, #>>, #Always, #AlwaysComb, #Always_comb, #Always_ff, #Assign, #CASE, #CASEX, #Clock, #CommonCFGReg, #DEFAULT, #Def, #ELSE, #ELSIF, #FOR, #FOREACH, #IF, #Initial, #Inout, #Input, #Instance, #Itgt_Instance, Main, #NameSpaceAdd, #Output, #Parameter, #Parameters, #Reset, #StateMachine, #TrackInf, #TryDef, #WHEN, #add_children_modules, #add_parent_modules, #add_to_new_module, allmodule_name, #always_ff, #always_sim, #assert, #assert_error, #assert_format_error, #assert_old, #bits, #call_instance, call_module, #children_inst_tree, #clog2, #debugLogic, #def_struct, #define_ele, #enum, exist_module?, #function, gen_sv_module, #gen_sv_module, #gen_sv_module_text, #generate, #genvar, #has_inward_inst?, #has_signal?, #implicit_inst_module_method_missing, #initial, #initial_exec, #initialize, #inout, #input, #instance_draw, #instanced, #inward_inst, #localparam, #logic, #logic_bind_, #macro_add_vcs, #method_missing, #negedge, #output, #parameter, #parents_inst_tree, #port, #posedge, #require_package, #rubyOP, #same_clock_domain, #show_ports, #signal, #top_module_ref?, #top_tb_ref?, #try_call_ele, #urandom_range, #var_common, #vars_define_inst, #vars_exec_inst, #vcs_string, #verify
Constructor Details
This class inherits a constructor from SdlModule
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SdlModule
Instance Method Details
#build_module(ex_param: "", ex_port: "", ex_up_code: "", ex_down_code: "") ⇒ Object
47 48 49 50 51 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 |
# File 'lib/tdl/class_hdl/hdl_package.rb', line 47 def build_module(ex_param: "",ex_port: "",ex_up_code: "",ex_down_code: "") # Tdl.Puts pagination(module_name) Tdl.Build_SdlModule_Puts(module_name) ex_param = ex_param.to_s unless ex_param ex_port = ex_port.to_s unless ex_port ex_up_code = ex_up_code.to_s unless ex_up_code ex_down_code = ex_down_code.to_s unless ex_down_code # gen_auto_method # auto generate class method for interface # draw = Tdl.inst + Tdl.draw instance_draw_str = instance_draw # It must run before vars_define_inst,because some signals define when inst vars_exec_inst_str = vars_exec_inst # It must run before vars_define_inst,because some signals define when vars exec post_str = post_inst_stack_call() unless post_str.strip.empty? post_str = pagination("ROOT REF") + post_str end draw = pagination("define") + vars_define_inst + pagination("instance") + instance_draw_str + pagination("expression") + vars_exec_inst_str + post_str unless ex_up_code.empty? ex_up_code = "\n//------>> EX CODE <<-------------------\n" + ex_up_code + "//------<< EX CODE >>-------------------\n" end unless ex_down_code.empty? ex_down_code = "//------>> EX CODE <<-------------------\n" + ex_down_code + "//------<< EX CODE >>-------------------\n" end # str = module_head+"module #{@module_name}" + build_params(ex_param) + build_ports(ex_port) + ex_up_code + gen_lite_str() + draw + ex_down_code + "\nendmodule\n" # unless GlobalParam.sim module_name_str = @module_name # else # module_name_str = @module_name+"_sim" # end str = module_head+"package #{module_name_str};\n" + build_params(ex_param) + ex_up_code + draw + ex_down_code + "\nendpackage:#{module_name_str}\n" + add_sub_module_file_paths create_vivado_tcl if @create_tcl create_constraints_file if @create_sdc return str end |
#build_params(ex_str = "") ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tdl/class_hdl/hdl_package.rb', line 9 def build_params(ex_str="") "Draw Parameters of sv module" str = [] max_len = 0 @port_params.each do |k,v| if v.port_length > max_len max_len = v.port_length; end end @port_params.each do |k,v| str << v.inst_port(max_len-v.port_length)+";" end unless ex_str.empty? head_tap = '//------>> EX PARAMETER <<-------------------'+"\n" end_tap = "\n//------<< EX PARAMETER >>-------------------"+"\n" else head_tap = "" end_tap = "" end if str.empty? if ex_str.empty? return "" else # ex_str.gsub!(/,\s*$/m,"") return head_tap + ex_str + end_tap end else # if (ex_str !~ /,\s*$/m) # ex_str = ex_str + ",\n" unless ex_str.empty? # end head_tap + ex_str + end_tap + str.join("\n") end end |
#macro_def ⇒ Object
5 6 7 |
# File 'lib/tdl/class_hdl/hdl_package.rb', line 5 def macro_def '' end |