How to easily group and drive signals in VHDL testbench

不打扰是莪最后的温柔 提交于 2021-01-27 23:27:08

问题


Let's say I have 3 control signals A, B and C.

In the testbench is there a function in VHDL to group this and iterate all cases quickly (to enable them to be iterated with a for loop for example) rather than write out 8 cases.

Psuedo code example:

for i in range 0 to 7
 grouped_signals <=std_logic_vector(to_unsigned(i,3)

回答1:


It can be a signal assignment where the target is an aggregate:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity agg_assign is
end entity;

architecture foo of agg_assign is
    signal A, B, C: std_logic;
begin
    process
    begin
        wait for 10 ns;
        for i in 0 to 7 loop
            (A, B, C) <= std_logic_vector(to_unsigned(i, 3));
            wait for 10 ns;
        end loop;
        wait;
    end process;
end architecture;

And that produces:



来源:https://stackoverflow.com/questions/43629450/how-to-easily-group-and-drive-signals-in-vhdl-testbench

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!