Skip to content

drivers: sensor: tenstorrent: pvt: use float instead of sensor_value#980

Open
alexapostolu wants to merge 1 commit intotenstorrent:mainfrom
alexapostolu:pvt-driver-raw
Open

drivers: sensor: tenstorrent: pvt: use float instead of sensor_value#980
alexapostolu wants to merge 1 commit intotenstorrent:mainfrom
alexapostolu:pvt-driver-raw

Conversation

@alexapostolu
Copy link
Member

Use float instead of sensor value when decoding from the rtio buffer. This simplifies conversions making the code shorter and neater.

Use float instead of sensor value when decoding from the rtio buffer.
This simplifies conversions making the code shorter and neater.

Signed-off-by: Alex Apostolu <aapostolu@tenstorrent.com>
@afongTT
Copy link
Contributor

afongTT commented Feb 10, 2026

I think Zephyr drivers try to avoid using floating point as much as possible (maybe that's a strict rule?), hence the weird sensor_value convention.

Maybe it's ok for us to use floating point to simplify the code, since we know the sensor driver will only be used on BH where we know there is an FPU.

Thoughts @danieldegrasse @jgrowdenTT @alewycky-tenstorrent?

@alexapostolu
Copy link
Member Author

alexapostolu commented Feb 10, 2026

Yea, we have an FPU, we don't have any cases where we need to be really precise with the floating point, and we do use the float immediately after the decode stage,

decoder->decode(cat_ts_avg_buf, (struct sensor_chan_spec){SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0},
			NULL, 1, &avg_tmp);

float catmon_error = catmon_temp - avg_tmp;

@afongTT
Copy link
Contributor

afongTT commented Feb 11, 2026

Looks like the decode stage is also already using float?

@alexapostolu
Copy link
Member Author

@afongTT Yea the decode stage converts the raw sensor value into a float. Sorry what I meant is that the decode value is used right away after decoding, so we minimize the cases where we just have a float sitting around doing nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants