Class: Integer

Inherits:
Object
  • Object
show all
Includes:
ClassHDL::AssignDefOpertor
Defined in:
lib/tdl/basefunc.rb,
lib/tdl/basefunc.rb,
lib/tdl/class_hdl/hdl_data.rb,
lib/tdl/axi4/axi4_interconnect_verb.rb,
lib/tdl/class_hdl/hdl_redefine_opertor.rb

Constant Summary

Constants included from ClassHDL::AssignDefOpertor

ClassHDL::AssignDefOpertor::OP_SYMBOLS

Instance Method Summary collapse

Methods included from ClassHDL::AssignDefOpertor

curr_assign_block, curr_assign_block=, curr_assign_block_stack, curr_opertor_stack, included, init_op_methods, use_new_yield_opertors, use_old_cond_opertors, with_new_assign_block, with_new_opertor, with_normal_opertor, with_rollback_opertors

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, arg = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/tdl/class_hdl/hdl_data.rb', line 3

def method_missing(method,arg=nil)
    if method.to_s =~ /^s?[h|d][\d|_]+$/i || method.to_s =~ /^s?[b](0|1|_)+$/i || method.to_s =~ /^s?[h][\d]?[\d|a-f|_]+$/i
        if self.nonzero?
            return "#{self.to_s}'#{method}".to_nq
        else 
            return "'#{method}".to_nq
        end 
    end

    super

end

Instance Method Details

#AObject

define_method(“”)



17
18
19
20
21
22
23
# File 'lib/tdl/class_hdl/hdl_data.rb', line 17

def A
    if self.zero?
        return "'0".to_nq
    else 
        return "~('0)".to_nq
    end
end

#clog2Object



264
265
266
267
268
# File 'lib/tdl/basefunc.rb', line 264

def clog2
    b = Math.log2(self)
    c = b.ceil
    return c
end

#real_dataObject



11
12
13
# File 'lib/tdl/axi4/axi4_interconnect_verb.rb', line 11

def real_data
    self
end

#to_hf(hf = "32'd") ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/tdl/basefunc.rb', line 111

def to_hf(hf="32'd")
    case hf 
    when /d/i
        rel = self.to_s 
    when /h/i
        rel = self.to_s 16
    when /b/i
        rel = self.to_s 2
    else 
        raise TdlError.new("Iteger TO HDL FORMAT ERROR [#{hf}]")
    end

    "#{hf}#{rel}".to_nq
end