Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit latency annotations on Values? #33

Open
VonTum opened this issue Nov 21, 2024 · 0 comments
Open

Explicit latency annotations on Values? #33

VonTum opened this issue Nov 21, 2024 · 0 comments
Labels
enhancement New feature or request Request Input These are issues about the design of the language, and thus should be discussed

Comments

@VonTum
Copy link
Collaborator

VonTum commented Nov 21, 2024

In the example:

// Recursive Tree Add module recurses smaller copies of itself. 
module TreeAdder #(int WIDTH) {
	interface TreeAdder : int[WIDTH] values'0 -> int total

	if WIDTH == 0 {
		// Have to explicitly give zero a latency count. 
		// Otherwise total's latency can't be determined. 
		int zero'0 = 0
		total = zero
	} else if WIDTH == 1 {
		total = values[0]
	} else {
		gen int L_SZ = WIDTH / 2
		gen int R_SZ = WIDTH - L_SZ

		int[L_SZ] left_part, int[R_SZ] right_part = SplitAt(values)

		int left_total = TreeAdder(left_part)
		int right_total = TreeAdder(right_part)
		
		// Can add pipelining registers here too. 
		// Latency Counting will figure it out.
		reg total = left_total + right_total
	}
}

We use int zero'0 = 0 because otherwise the LC system can't figure out the absolute latency for total

Perhaps we could add a way to annotate the constant directly? Like total = 0'0

@VonTum VonTum added enhancement New feature or request Request Input These are issues about the design of the language, and thus should be discussed labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Request Input These are issues about the design of the language, and thus should be discussed
Projects
None yet
Development

No branches or pull requests

1 participant