Method: BOAST::Int#initialize

Defined in:
lib/BOAST/Language/DataTypes.rb

#initialize(hash = {}) ⇒ Int

Creates a new instance of Int.

Options Hash (hash):



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/BOAST/Language/DataTypes.rb', line 167

def initialize(hash={})
  if hash[:size] then
    @size = hash[:size]
  else
    @size = get_default_int_size
  end
  if hash[:signed] != nil then
    @signed = hash[:signed]
  else
    @signed = get_default_int_signed
  end
  if hash[:vector_length] and hash[:vector_length] > 1 then
    @vector_length = hash[:vector_length]
    raise "Vectors need to have their element size specified!" unless @size
  else
    @vector_length = 1
  end
  @total_size = @size*@vector_length
end