Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initialize the vector in chisel

Tags:

chisel

I want to initialize the vector as a constant. I write the following codes:

val routing_p0 = Wire(Vec(1.U(6.W), 6.U(6.W), 11.U(6.W), 30.U(6.W), 21.U(6.W), 58.U(6.W), 59.U(6.W), 20.U(6.W), 41.U(6.W), 37.U(6.W), 52.U(6.W), 15.U(6.W), 54.U(6.W), 23.U(6.W), 39.U(6.W), 9.U(6.W), 18.U(6.W), 31.U(6.W), 10.U(6.W), 38.U(6.W), 40.U(6.W), 22.U(6.W), 29.U(6.W), 56.U(6.W), 44.U(6.W), 50.U(6.W), 45.U(6.W), 55.U(6.W), 14.U(6.W), 32.U(6.W), 17.U(6.W), 4.U(6.W), 35.U(6.W), 47.U(6.W), 61.U(6.W), 42.U(6.W), 19.U(6.W), 8.U(6.W), 12.U(6.W), 5.U(6.W), 16.U(6.W), 51.U(6.W), 43.U(6.W), 60.U(6.W), 57.U(6.W), 28.U(6.W), 48.U(6.W), 34.U(6.W), 24.U(6.W), 53.U(6.W), 36.U(6.W), 3.U(6.W), 26.U(6.W), 62.U(6.W), 46.U(6.W), 49.U(6.W), 27.U(6.W), 2.U(6.W), 63.U(6.W), 25.U(6.W), 33.U(6.W), 13.U(6.W), 7.U(6.W), 0.U(6.W)))

routing_p0 is a constants which type is vec(64, UInt(6.W)).

I got error while compiling codes.

What should I do for solving this?

like image 385
Self-Motivated Wu Avatar asked Nov 28 '25 11:11

Self-Motivated Wu


1 Answers

You should use VecInit() without Wire. Be aware that routing_p0 is type of Vec(64, UInt(6.W)) (with upper case 'V'):

  val routing_p0 = VecInit(1.U(6.W), 6.U(6.W), 11.U(6.W), 30.U(6.W), 21.U(6.W), 58.U(6.W), 59.U(6.W), 20.U(6.W), 41.U(6.W), 37.U(6.W), 52.U(6.W), 15.U(6.W), 54.U(6.W), 23.U(6.W), 39.U(6.W), 9.U(6.W), 18.U(6.W), 31.U(6.W), 10.U(6.W), 38.U(6.W), 40.U(6.W), 22.U(6.W), 29.U(6.W), 56.U(6.W), 44.U(6.W), 50.U(6.W), 45.U(6.W), 55.U(6.W), 14.U(6.W), 32.U(6.W), 17.U(6.W), 4.U(6.W), 35.U(6.W), 47.U(6.W), 61.U(6.W), 42.U(6.W), 19.U(6.W), 8.U(6.W), 12.U(6.W), 5.U(6.W), 16.U(6.W), 51.U(6.W), 43.U(6.W), 60.U(6.W), 57.U(6.W), 28.U(6.W), 48.U(6.W), 34.U(6.W), 24.U(6.W), 53.U(6.W), 36.U(6.W), 3.U(6.W), 26.U(6.W), 62.U(6.W), 46.U(6.W), 49.U(6.W), 27.U(6.W), 2.U(6.W), 63.U(6.W), 25.U(6.W), 33.U(6.W), 13.U(6.W), 7.U(6.W), 0.U(6.W))

like image 117
FabienM Avatar answered Nov 30 '25 06:11

FabienM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!