Skip to content

sc_clock: check for NaN duty cycle - #174

Open
atalii wants to merge 1 commit into
accellera-official:mainfrom
atalii:nan-duty-cycle
Open

sc_clock: check for NaN duty cycle#174
atalii wants to merge 1 commit into
accellera-official:mainfrom
atalii:nan-duty-cycle

Conversation

@atalii

@atalii atalii commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

A NaN duty cycle is disallowed by §6.7.4 (b):

The duty cycle shall lie between the limits 0.0 and 1.0, exclusive.

Since the existing behavior for out-of-range duty cycles is to set it to 0.5, I believe it's appropriate to do the same here. Emitting a warning may also be desirable.

(See a failing test-case here: 0db6cff. I have confirmed that this patch fixes the failure.)

@aut0

aut0 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@atalii, could you please rebase on main?

@maehne maehne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for NaN makes sense, but use std::isnan() available since C++'11.

Comment thread src/sysc/communication/sc_clock.cpp Outdated
Comment thread src/sysc/communication/sc_clock.cpp Outdated
This is disallowed by §6.7.4 (b):

	The duty cycle shall lie between the limits 0.0 and 1.0,
	exclusive. The default duty cycle is 0.5.

Signed-off-by: Tali Auster <me@tali.network>
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.

3 participants