Skip to content

Conversation

@Paulo-D2000
Copy link
Contributor

Just rounding up the result from log2

"Rounding" 0 to 1 by adding extra 1...
Possible fix to uint0_t RAM function
addr_t = (
"uint"
+ str(int(math.ceil(math.log(dim, 2))))
+ str(int(math.ceil(math.log(dim, 2)))+1) #round up by 1
Copy link
Owner

@JulianKemmerer JulianKemmerer Jul 2, 2024

Choose a reason for hiding this comment

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

Reasonable, but I prefer to keep the width exact as needed

For ex. you need two address bits to address four things
but the round up by one makes it 3 bits for dim=4

hmm maybe just need a simple 'its uint1 unless >1 then do math as is'

Copy link
Owner

Choose a reason for hiding this comment

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

There is another place this math occurs at for sizing muxes in this same file

sel_width = int(math.ceil(math.log(n, 2)))

mind changing there too?

And searching repo I found one more place

"uint" + str(int(math.ceil(math.log(first_dim, 2)))) + "_t"

could maybe make a common helper func in https://github.com/JulianKemmerer/PipelineC/blob/master/src/utilities.py
but not critical

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