Class: GenBlockModule

Inherits:
SdlModule show all
Defined in:
lib/tdl/sdlmodule/generator_block_module.rb

Instance Attribute Summary collapse

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

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, #build_module, #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, #inout, #input, #instance_draw, #instanced, #inward_inst, #localparam, #logic, #logic_bind_, #macro_add_vcs, #macro_def, #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

#initialize(name: "GenBlock", belong_to_module: nil) ⇒ GenBlockModule

Returns a new instance of GenBlockModule.



4
5
6
7
8
9
# File 'lib/tdl/sdlmodule/generator_block_module.rb', line 4

def initialize(name: "GenBlock",belong_to_module:nil)
    super(name:"#{name}")
    @dont_gen_sv = true

    @belong_to_module = belong_to_module
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SdlModule

Instance Attribute Details

#belong_to_moduleObject

Returns the value of attribute belong_to_module.



3
4
5
# File 'lib/tdl/sdlmodule/generator_block_module.rb', line 3

def belong_to_module
  @belong_to_module
end

Instance Method Details

#Else(&block) ⇒ Object



22
23
24
# File 'lib/tdl/sdlmodule/generator_block_module.rb', line 22

def Else(&block)
    @_if_collect_str_ += gen_if("else",nil,&block)
end

#ElsIf(nq_operation, &block) ⇒ Object



18
19
20
# File 'lib/tdl/sdlmodule/generator_block_module.rb', line 18

def ElsIf(nq_operation,&block)
    @_if_collect_str_ += gen_if("else if",nq_operation,&block)
end

#gen_if_block_strObject



36
37
38
39
40
# File 'lib/tdl/sdlmodule/generator_block_module.rb', line 36

def gen_if_block_str
    @_if_collect_str_.gsub!(/^./) do |m|
        "#{'    '*$generate_tap_igt}#{m}"
    end
end

#If(nq_operation, &block) ⇒ Object



13
14
15
16
# File 'lib/tdl/sdlmodule/generator_block_module.rb', line 13

def If(nq_operation,&block)
    @_if_collect_str_ ||= ""
    @_if_collect_str_ += gen_if("if",nq_operation,&block)
end

#if_block {|tmp_sm| ... } ⇒ Object

Yields:

  • (tmp_sm)


26
27
28
29
30
31
32
33
34
# File 'lib/tdl/sdlmodule/generator_block_module.rb', line 26

def if_block(&block)
    head_str = "//-----------------------------------------------------------\n"
    end_str =  "//===========================================================\n"
    @_if_sub_gen_block_module_id ||= 0
    tmp_sm = GenBlockModule.new(name:"#{@belong_to_module.module_name}_generator_if_block_#{@_if_sub_gen_block_module_id}",belong_to_module:self)# SUB MODULE
    @_if_sub_gen_block_module_id += 1
    yield(tmp_sm)
    GenInnerStr.new(head_str.concat(tmp_sm.gen_if_block_str).concat(end_str))
end