简体   繁体   English

如何在chisel中初始化向量

[英]How to initialize the vector in 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)). routing_p0 是一个类型为 vec(64, UInt(6.W)) 的常量。

I got error while compiling codes.编译代码时出错。

What should I do for solving this?我应该怎么做才能解决这个问题?

You should use VecInit() without Wire.您应该在没有 Wire 的情况下使用VecInit() Be aware that routing_p0 is type of Vec(64, UInt(6.W)) (with upper case ' V '):请注意, routing_p0Vec(64, UInt(6.W)) (带有大写的“ 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))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM