Class: LibFST::Writer::Variable

Inherits:
Object
  • Object
show all
Defined in:
ext/libfst_rb.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#alias_ofVariable? (readonly)

Returns:

#directionSymbol (readonly)

Returns either :implicit, :input, :output, :inout, :buffer or :linkage.

Returns:

  • (Symbol)

    either :implicit, :input, :output, :inout, :buffer or :linkage

#handleInteger (readonly)

Returns:

  • (Integer)

#lengthInteger (readonly)

Returns:

  • (Integer)

#nameString (readonly)

Returns:

  • (String)

#sup_data_typeSymbol? (readonly)

Returns supplemental data type, either :none, :vhdl_boolean, :vhdl_bit, :vhdl_bit_vector, :vhdl_std_ulogic, :vhdl_std_ulogic_vector, :vhdl_std_logic, :vhdl_std_logic_vector, :vhdl_unsigned, :vhdl_signed, :vhdl_integer, :vhdl_real, :vhdl_natural, :vhdl_positive, :vhdl_time, :vhdl_character or :vhdl_string.

Returns:

  • (Symbol, nil)

    supplemental data type, either :none, :vhdl_boolean, :vhdl_bit, :vhdl_bit_vector, :vhdl_std_ulogic, :vhdl_std_ulogic_vector, :vhdl_std_logic, :vhdl_std_logic_vector, :vhdl_unsigned, :vhdl_signed, :vhdl_integer, :vhdl_real, :vhdl_natural, :vhdl_positive, :vhdl_time, :vhdl_character or :vhdl_string

#sup_type_strString? (readonly)

Returns supplemental type string.

Returns:

  • (String, nil)

    supplemental type string

#sup_var_typeSymbol? (readonly)

Returns supplemental variable type, either :none, :vhdl_signal, :vhdl_variable, :vhdl_constant, :vhdl_file or :vhdl_memory.

Returns:

  • (Symbol, nil)

    supplemental variable type, either :none, :vhdl_signal, :vhdl_variable, :vhdl_constant, :vhdl_file or :vhdl_memory

#typeSymbol (readonly)

Returns either :vcd_event, :vcd_integer, :vcd_parameter, :vcd_real, :vcd_real_parameter, :vcd_reg, :vcd_supply0, :vcd_supply1, :vcd_time, :vcd_tri, :vcd_triand, :vcd_trior, :vcd_trireg, :vcd_tri0, :vcd_tri1, :vcd_wand, :vcd_wire, :vcd_wor, :vcd_port, :vcd_sparray, :vcd_realtime, :gen_string, :sv_bit, :sv_logic, :sv_int, :sv_shortint, :sv_longint, :sv_byte, :sv_enum or :sv_shortreal.

Returns:

  • (Symbol)

    either :vcd_event, :vcd_integer, :vcd_parameter, :vcd_real, :vcd_real_parameter, :vcd_reg, :vcd_supply0, :vcd_supply1, :vcd_time, :vcd_tri, :vcd_triand, :vcd_trior, :vcd_trireg, :vcd_tri0, :vcd_tri1, :vcd_wand, :vcd_wire, :vcd_wor, :vcd_port, :vcd_sparray, :vcd_realtime, :gen_string, :sv_bit, :sv_logic, :sv_int, :sv_shortint, :sv_longint, :sv_byte, :sv_enum or :sv_shortreal

#writerWriter (readonly)

Returns:

Instance Method Details

#valueObject

Return the last set value.

Returns:

  • (Object)


2242
2243
2244
2245
# File 'ext/libfst_rb.c', line 2242

static VALUE libfst_writervariable_get_value(VALUE self)
{
  return rb_ivar_get(self, id_at_value);
}

#value=(value) ⇒ Object

Emit the given value.

Parameters:

  • value (String, Integer, Float, nil)

Returns:

  • (Object)

    value



2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
# File 'ext/libfst_rb.c', line 2178

static VALUE libfst_writervariable_emit_value(VALUE self, VALUE value)
{
  VALUE rbtype = rb_ivar_get(self, id_at_type);
  enum fstVarType type = symbol_to_fstVarType(rbtype);
  switch (type) {
    case FST_VT_VCD_REG:
    case FST_VT_VCD_SUPPLY0:
    case FST_VT_VCD_SUPPLY1:
    case FST_VT_VCD_TRI:
    case FST_VT_VCD_TRIAND:
    case FST_VT_VCD_TRIOR:
    case FST_VT_VCD_TRIREG:
    case FST_VT_VCD_TRI0:
    case FST_VT_VCD_TRI1:
    case FST_VT_VCD_WAND:
    case FST_VT_VCD_WIRE:
    case FST_VT_VCD_WOR:
    case FST_VT_VCD_PORT:
    case FST_VT_VCD_SPARRAY:
    case FST_VT_SV_BIT:
    case FST_VT_SV_LOGIC:
      libfst_writer_emit_logic(self, value);
      break;

    case FST_VT_VCD_REAL:
    case FST_VT_VCD_REAL_PARAMETER:
    case FST_VT_VCD_REALTIME:
    case FST_VT_SV_SHORTREAL:
      libfst_writer_emit_float(self, value);
      break;

    case FST_VT_VCD_INTEGER:
    case FST_VT_VCD_PARAMETER:
    case FST_VT_SV_INT:
    case FST_VT_SV_SHORTINT:
    case FST_VT_SV_LONGINT:
    case FST_VT_SV_BYTE:
    case FST_VT_VCD_TIME:
      libfst_writer_emit_integer(self, value);
      break;

    case FST_VT_GEN_STRING:
      libfst_writer_emit_string(self, value);
      break;

    case FST_VT_VCD_EVENT:
      libfst_writer_emit_event(self);
      break;

    case FST_VT_SV_ENUM:
      rb_raise(rb_eRuntimeError, "Sorry, I dont know how to handle enums =(");
      break;

    default:
      rb_raise(rb_eRuntimeError, "%s has invalid @type (%"PRIsVALUE")", rb_obj_classname(self), rbtype);
  }
  rb_ivar_set(self, id_at_value, value);
  return value;
}