olo_fix_sim_from_real¶
Status Information¶
VHDL Source: olo_fix_from_real
Bit-true Model: olo_fix_from_real
Description¶
This entity converts a real (floating-point) number to fixed-point format. It is aimed to be used in simulations (python bit-true simulations - not HDL simulations).
Note that functionally the entity is equivalent to the olo_fix_from_real entity, but it is designed for simulation purposes only. Therefore the python model of olo_fix_from_real is used also for olo_fix_sim_from_real.
The olo_fix_sim_from_real entity has two main use-cases:
- Create fixed-point representation of constants
- Example: Calculation of the gravitational force
- A real constant with the value 9.81 is defined (good readability)
- For fixed-point calculations, the constant is converted to fixed-point representation using olo_fix_from_real
- In this case the input is static, therefore the generic interface (Value_g) is used
- Create fixed-point representation of real values in simulation
- Example: Motor controller simulation
- The position produced by a motor model is a real value
- For injecting the position into the tested motor controller entity, it is converted to fixed-point representation using olo_fix_from_real
- In this case the input is changing at runtime, therefore the port interface (In_Value) is used.
Warning: Not all tools can synthesize this entity, even when the Real input is not connected. For synthesis, always use olo_fix_from_real instead.
For details about the fixed-point number format used in Open Logic, refer to the fixed point principles.
Generics¶
| Name | Type | Default | Description |
|---|---|---|---|
| ResultFmt_g | string | - | Format of the result String representation of an en_cl_fix Format_t (e.g. "(0,1,15)") |
| Saturate_g | string | "SatWarn_s" | Saturation mode String representation of an en_cl_fix FixSaturate_t. |
| Value_g | real | 0.0 | Generic to be used for compile-time static inputs. Leave unconnected if In_Value is used. |
Interfaces¶
Input Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| In_Value | in | N/A (real) | Value_g | Input data Leave unconnected if Value_g is used |
Output Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Out_Value | out | width(ResultFmt_g) | N/A | Output data |
Detail¶
No detailed description required. All details that could be mentioned here are already covered by fixed point principles.