CIRCT 22.0.0git
Loading...
Searching...
No Matches
Functions
Expressions.cpp File Reference
#include "ImportVerilogInternals.h"
#include "slang/ast/EvalContext.h"
#include "slang/ast/SystemSubroutine.h"
#include "slang/syntax/AllSyntax.h"
Include dependency graph for Expressions.cpp:

Go to the source code of this file.

Functions

static FVInt convertSVIntToFVInt (const slang::SVInt &svint)
 Convert a Slang SVInt to a CIRCT FVInt.
 
static Value getSelectIndex (Context &context, Location loc, Value index, const slang::ConstantRange &range)
 Map an index into an array, with bounds range, to a bit offset of the underlying bit storage.
 
static uint64_t getTimeScaleInFemtoseconds (Context &context)
 Get the currently active timescale as an integer number of femtoseconds.
 
static Value materializePackedToSBVConversion (Context &context, Value value, Location loc)
 Create the necessary operations to convert from a PackedType to the corresponding simple bit vector IntType.
 
static Value materializeSBVToPackedConversion (Context &context, moore::PackedType packedType, Value value, Location loc)
 Create the necessary operations to convert from a simple bit vector IntType to an equivalent PackedType.
 

Function Documentation

◆ convertSVIntToFVInt()

static FVInt convertSVIntToFVInt ( const slang::SVInt &  svint)
static

Convert a Slang SVInt to a CIRCT FVInt.

Definition at line 19 of file Expressions.cpp.

Referenced by circt::ImportVerilog::Context::materializeSVInt().

◆ getSelectIndex()

static Value getSelectIndex ( Context context,
Location  loc,
Value  index,
const slang::ConstantRange &  range 
)
static

Map an index into an array, with bounds range, to a bit offset of the underlying bit storage.

This is a dynamic version of slang::ConstantRange::translateIndex.

Definition at line 34 of file Expressions.cpp.

References circt::ImportVerilog::Context::builder, and circt::ImportVerilog::Context::materializeConversion().

◆ getTimeScaleInFemtoseconds()

static uint64_t getTimeScaleInFemtoseconds ( Context context)
static

Get the currently active timescale as an integer number of femtoseconds.

Definition at line 64 of file Expressions.cpp.

References assert(), and circt::ImportVerilog::Context::timeScale.

Referenced by materializePackedToSBVConversion(), and materializeSBVToPackedConversion().

◆ materializePackedToSBVConversion()

static Value materializePackedToSBVConversion ( Context context,
Value  value,
Location  loc 
)
static

Create the necessary operations to convert from a PackedType to the corresponding simple bit vector IntType.

This will apply special handling to time values, which requires scaling by the local timescale.

Definition at line 1383 of file Expressions.cpp.

References assert(), circt::ImportVerilog::Context::builder, circt::moore::FourValued, getTimeScaleInFemtoseconds(), and circt::moore::isIntType().

Referenced by circt::ImportVerilog::Context::materializeConversion().

◆ materializeSBVToPackedConversion()

static Value materializeSBVToPackedConversion ( Context context,
moore::PackedType  packedType,
Value  value,
Location  loc 
)
static

Create the necessary operations to convert from a simple bit vector IntType to an equivalent PackedType.

This will apply special handling to time values, which requires scaling by the local timescale.

Definition at line 1420 of file Expressions.cpp.

References assert(), circt::ImportVerilog::Context::builder, circt::moore::PackedType::containsTimeType(), circt::moore::FourValued, circt::moore::PackedType::getSimpleBitVector(), getTimeScaleInFemtoseconds(), and circt::moore::isIntType().

Referenced by circt::ImportVerilog::Context::materializeConversion().