Skip to content
New issue

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

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

Already on GitHub? # to your account

There is VecInit.tabulate, why not VecInit.fill? #1472

Closed
mwachs5 opened this issue Jun 10, 2020 · 2 comments
Closed

There is VecInit.tabulate, why not VecInit.fill? #1472

mwachs5 opened this issue Jun 10, 2020 · 2 comments

Comments

@mwachs5
Copy link
Contributor

mwachs5 commented Jun 10, 2020

Type of issue: feature request

Impact: API addition (no impact on existing code)

Development Phase: request

Other information

It looks like there is a VecInit.tabulate. But there isn't a VecInit.fill. This seems asymmetrical.
There is VecINit(Seq.fill(...) {...}) but this is more verbose. Why should there be one and not the other?

https://www.chisel-lang.org/api/latest/chisel3/VecInit$.html#tabulate[T%3C:chisel3.Data](n:Int)(gen:Int=%3ET):chisel3.Vec[T]

If the current behavior is a bug, please provide the steps to reproduce the problem:

What is the current behavior?

There is only VecInit.tabulate, so you have to do somethign like VecInit.tabulate(num){unused => false.b})

What is the expected behavior?

That one could call VecInit.fill(num){false.b}

Please tell us about your environment:

What is the use case for changing the behavior?

more consistent, intuitive API

@jackkoenig
Copy link
Contributor

jackkoenig commented Jun 10, 2020

Yeah this is an oversight. Since Vec extends Seq, perhaps we should have VecInit extend SeqFactory (https://www.scala-lang.org/api/2.12.10/scala/collection/generic/SeqFactory.html) This would give us all of the expected constructors. That would require fixing #1354 as well.

@mwachs5
Copy link
Contributor Author

mwachs5 commented Aug 27, 2021

Closed by #2059 , thanks @anniej-sifive !

@mwachs5 mwachs5 closed this as completed Aug 27, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants