| 340 | } |
| 341 | |
| 342 | UHDM::constant* CompileHelper::constantFromValue(Value* val, |
| 343 | CompileDesign* compileDesign) { |
| 344 | Serializer& s = compileDesign->getSerializer(); |
| 345 | Value::Type valueType = val->getType(); |
| 346 | UHDM::constant* c = nullptr; |
| 347 | switch (valueType) { |
| 348 | case Value::Type::Scalar: { |
| 349 | c = s.MakeConstant(); |
| 350 | c->VpiConstType(vpiScalarVal); |
| 351 | c->VpiValue(val->uhdmValue()); |
| 352 | c->VpiDecompile(val->decompiledValue()); |
| 353 | c->VpiSize(1); |
| 354 | break; |
| 355 | } |
| 356 | case Value::Type::Binary: { |
| 357 | c = s.MakeConstant(); |
| 358 | c->VpiConstType(vpiBinStrVal); |
| 359 | c->VpiValue(val->uhdmValue()); |
| 360 | c->VpiDecompile(val->decompiledValue()); |
| 361 | c->VpiSize(val->getSize()); |
| 362 | break; |
| 363 | } |
| 364 | case Value::Type::Hexadecimal: { |
| 365 | c = s.MakeConstant(); |
| 366 | c->VpiConstType(vpiHexStrVal); |
| 367 | c->VpiValue(val->uhdmValue()); |
| 368 | c->VpiDecompile(val->decompiledValue()); |
| 369 | c->VpiSize(val->getSize()); |
| 370 | break; |
| 371 | } |
| 372 | case Value::Type::Octal: { |
| 373 | c = s.MakeConstant(); |
| 374 | c->VpiConstType(vpiOctStrVal); |
| 375 | c->VpiValue(val->uhdmValue()); |
| 376 | c->VpiDecompile(val->decompiledValue()); |
| 377 | c->VpiSize(val->getSize()); |
| 378 | break; |
| 379 | } |
| 380 | case Value::Type::Unsigned: |
| 381 | case Value::Type::Integer: { |
| 382 | c = s.MakeConstant(); |
| 383 | c->VpiConstType(vpiIntVal); |
| 384 | c->VpiValue(val->uhdmValue()); |
| 385 | c->VpiDecompile(val->decompiledValue()); |
| 386 | c->VpiSize(val->getSize()); |
| 387 | break; |
| 388 | } |
| 389 | case Value::Type::Double: { |
| 390 | c = s.MakeConstant(); |
| 391 | c->VpiConstType(vpiRealVal); |
| 392 | c->VpiValue(val->uhdmValue()); |
| 393 | c->VpiDecompile(val->decompiledValue()); |
| 394 | c->VpiSize(val->getSize()); |
| 395 | break; |
| 396 | } |
| 397 | case Value::Type::String: { |
| 398 | c = s.MakeConstant(); |
| 399 | c->VpiConstType(vpiStringVal); |
nothing calls this directly
no test coverage detected