Class: HDLClass::ImplicitInstParam

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/class_hdl/hdl_parameter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sdlm) ⇒ ImplicitInstParam

Returns a new instance of ImplicitInstParam.



5
6
7
8
# File 'lib/tdl/class_hdl/hdl_parameter.rb', line 5

def initialize(sdlm)
    @sdlm = sdlm
    @type = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

def -(name)

@sdlm.Parameter(name,value=0,type:nil,show:true)

end



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/tdl/class_hdl/hdl_parameter.rb', line 29

def method_missing(name,*args,&block)
    if name !~ /\w+/
        raise TdlError.new("cont define parameter name #{name}")
    end
    if args.any?
        unless local
            relp = @sdlm.Parameter(name,args[0],type:@type,show:true)
        else 
            relp = @sdlm.Def.parameter(name: name,value: args[0],local:true,type:@type)
        end
        if vcs_string
            relp.vcs_string = vcs_string
        end
        relp
    else 
        @sdlm.public_send(name)
    end
end

Instance Attribute Details

#localObject

Returns the value of attribute local.



4
5
6
# File 'lib/tdl/class_hdl/hdl_parameter.rb', line 4

def local
  @local
end

#vcs_stringObject

Returns the value of attribute vcs_string.



4
5
6
# File 'lib/tdl/class_hdl/hdl_parameter.rb', line 4

def vcs_string
  @vcs_string
end

Instance Method Details

#[](num) ⇒ Object



10
11
12
13
# File 'lib/tdl/class_hdl/hdl_parameter.rb', line 10

def [](num)
    @type = "[#{num}-1:0]"
    self
end

#intObject



20
21
22
23
# File 'lib/tdl/class_hdl/hdl_parameter.rb', line 20

def int 
    @type = 'int'
    return self 
end

#realObject



15
16
17
18
# File 'lib/tdl/class_hdl/hdl_parameter.rb', line 15

def real
    @type = 'real'
    return self 
end