Verilog数组语法(Verilog array syntax)

编程入门 行业动态 更新时间:2024-10-25 22:33:13
Verilog数组语法(Verilog array syntax)

我是Verilog的新手,并且遇到了很多麻烦。 例如,我想要有一个8个单元的数组,每个单元都是8位宽。 以下不起作用:

reg [7:0] transitionTable [0:7]; assign transitionTable[0] = 10;

也没有做transitionTable[0] = 10; 或transitionTable[0] = 8'h10; 有任何想法吗?

(如果它不明显且相关:我想创建一个有限状态机,并在一个数组中指定状态转换,因为这似乎比大规模案例开关更容易。)

I'm new to Verilog, and am having a lot of trouble with it. For example, I want to have an array with eight cells, each of which is 8 bits wide. The following doesn't work:

reg [7:0] transitionTable [0:7]; assign transitionTable[0] = 10;

neither does just doing transitionTable[0] = 10; or transitionTable[0] = 8'h10; Any ideas?

(In case it is not obvious and relevant: I want to make a finite state machine, and specify the state transitions in an array, since that seems easier than a massive case switch.)

最满意答案

当使用assign你应该将数组声明为wire而不是reg 。

When using assign you should declare the array as a wire instead of areg.

更多推荐

本文发布于:2023-08-01 17:31:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1361572.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   语法   Verilog   array   syntax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!