olo_fix_sample_hold¶
Status Information¶
VHDL Source: olo_fix_sample_hold
Bit-true Model: olo_fix_sample_hold
Description¶
This entity implemets a sample and hold for fixed-point numbers. The output holds the last sampled value until a new sample is taken.
This can be used for example as a simiple synchronization mechanism for data-streams with different sample rates or to synchronize feedback paths to the sample rate of the input.
For details about the two use-cases, refer to the documentation of olo_base_sample_hold which is the bit-vector version of this entity.
Latency of this entity is 1 clock cycle.
For details about the fixed-point number format used in Open Logic, refer to the fixed point principles.
Generics¶
| Name | Type | Default | Description |
|---|---|---|---|
| Fmt_g | string | - | Data format String representation of an en_cl_fix Format_t (e.g. "(1,1,15)") |
| ResetValue_g | real | 0.0 | Value to apply to output before the first input sample arrives |
| ResetValid_g | boolean | true | True: Out_Valid is asserted after reset (while ResetValue_g is applied) False: Out_Valid is not asserted until the first sample arrives |
Interfaces¶
Control¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Clk | in | 1 | - | Clock |
| Rst | in | 1 | - | Reset input (high-active, synchronous to Clk) |
Input Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| In_Data | in | width(Fmt_g) | - | Input data Format: Fmt_g |
| In_Valid | in | 1 | - | AXI4-Stream handshaking signal for In_Data |
Output Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Out_Data | out | width(Fmt_g) | N/A | Output data Format Fmt_g |
| Out_Valid | out | 1 | N/A | AXI-S handshaking signal for Out_Data |
Detail¶
Python Model¶
Open Logic bit-true python models do not reflect timing behavior but only sample data. Hence the model of olo_fix_sample_hold cannot reflect the exact timing behavior.
The model is written to reflect the capability of olo_fix_sample_hold to reproduce or drop samples and to hold the last value (as required for feedback synchronization).
The model does always output the last sample it received as input. The user can pass as argument to the next() and process() methods how many output samples shall be produced.
# Create model instance
dut = olo_fix_sample_hold(fmt=self.FMT)
# Inject one sample
dut.next(input=1.0)
# Comsume three samples (all wil be 1.0)
data_a = dut.next(out_samples=1)
# Inject three samples
dut.next(input=[2.0, 3.0, 4.0])
# Consume one sample (will be 4.0)
data_b = dut.next(out_samples=1)