状态到 std_logic
我已将我的状态定义如下:
type state_type is (s0, s1, s2, s3);
signal state : state_type;
现在我想使用此状态信息来形成另一个信号
signal data : std_logic_vector(3 downto 0);
signal data_plus_state : std_logic_vector(5 downto 0);
....
data_plus_state <= data & state;
有谁知道我如何将状态协调到 std_logic_vector 中,以便我可以连接这些 两个信号?
非常感谢, 抢
I have defined my state as follows:
type state_type is (s0, s1, s2, s3);
signal state : state_type;
Now I would like to use this state information to form another signal
signal data : std_logic_vector(3 downto 0);
signal data_plus_state : std_logic_vector(5 downto 0);
....
data_plus_state <= data & state;
Does anyone know how I can concert state into a std_logic_vector so that I can concatenate these
two signals?
Many thanks,
Rob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
定义一个将状态转换为 std_logic_vector 的子程序。
该子程序包含一个 case 语句,例如:
Define a subprogram that convert state to std_logic_vector.
That subprogram contains a case statement, something like:
子程序和案例答案会很好地工作。如果你想要一些排队的东西,你可以使用这个。
干杯
The subprogram and case answer would work very well. If you wanted something in line you could use this.
Cheers
看来您想将两个(或更多)信号放入一个信号(或端口)中。
这里的方法不是连接信号,而是将它们放入记录中。优点是信号各部分的语义(意义)得到清晰表达。这样您就不必对每个数据元素进行编码(然后再解码)。
然后您可以将两个信号放入一个记录信号中:
It seems you want to put two (or more) signals into one signal (or port).
The way to go here is not concatenating the signals, but rather put them in a record. The advantage is that the semantics (the meaning) of each part of the signal is clearly expressed. This way you don't have to encode (and later decode) every data element.
Then you can put the two signals in a single record signal: