当 rst=' 1' 时重新开始输入信号
Start again input signals when rst=' 1'
我正在尝试在重置信号启动时重置电路中的输入值。
我正在用 VHLD 写 Xilinx 的 Vivado。
signal Xin : signed(4 downto 0) := (others => '0');
...
stim_process: process
begin
Xin <= to_signed(1030,5); wait for clk_period;
Xin <= to_signed(1050,5); wait for clk_period;
Xin <= to_signed(1040,5); wait for clk_period;
Xin <= to_signed(1080,5); wait for clk_period;
Xin <= to_signed(1100,5); wait for clk_period;
Xin <= to_signed(0,5); wait until Rst= '1';
Xin <= to_signed(1030,5); wait for clk_period;
Xin <= to_signed(1050,5); wait for clk_period;
Xin <= to_signed(1040,5); wait for clk_period;
Xin <= to_signed(1080,5); wait for clk_period;
Xin <= to_signed(1100,5); wait for clk_period;
Xin <= to_signed(0,5);
wait;
end process;
这样,在分配完所有输入后发送一个复位信号,我得到了想要的结果。
问题是:
I can not find a way to reset the sequence of input signals at any time and how many times I want.
重写它以将有关序列中位置的信息保留为状态信息,例如:
process (rst, clk) is
begin
if rst = '1' then
State <= 0;
Xin <= to_signed(1030,5);
elsif rising_edge(clk) then
case State is
when 0 => Xin <= to_signed(1030,5);
when 1 => Xin <= to_signed(1050,5);
when 2 => Xin <= to_signed(1040,5);
when 3 => Xin <= to_signed(1080,5);
when 4 => Xin <= to_signed(1100,5);
when others => Xin <= to_signed(0,5);
end case;
State <= State + 1;
end if;
end process;
rst
中的重置可以立即生效,并重复进行。
根据您需要的时间,可能需要对上述内容进行小幅更新,但按照此行编写的代码应该可以完成工作。
顺便说一句。将值 1030 to_signed
转换为 5 位 Xin
看起来很奇怪,因为 1030 的值至少需要 12 位来表示有符号。
我正在尝试在重置信号启动时重置电路中的输入值。
我正在用 VHLD 写 Xilinx 的 Vivado。
signal Xin : signed(4 downto 0) := (others => '0');
...
stim_process: process
begin
Xin <= to_signed(1030,5); wait for clk_period;
Xin <= to_signed(1050,5); wait for clk_period;
Xin <= to_signed(1040,5); wait for clk_period;
Xin <= to_signed(1080,5); wait for clk_period;
Xin <= to_signed(1100,5); wait for clk_period;
Xin <= to_signed(0,5); wait until Rst= '1';
Xin <= to_signed(1030,5); wait for clk_period;
Xin <= to_signed(1050,5); wait for clk_period;
Xin <= to_signed(1040,5); wait for clk_period;
Xin <= to_signed(1080,5); wait for clk_period;
Xin <= to_signed(1100,5); wait for clk_period;
Xin <= to_signed(0,5);
wait;
end process;
这样,在分配完所有输入后发送一个复位信号,我得到了想要的结果。
问题是:
I can not find a way to reset the sequence of input signals at any time and how many times I want.
重写它以将有关序列中位置的信息保留为状态信息,例如:
process (rst, clk) is
begin
if rst = '1' then
State <= 0;
Xin <= to_signed(1030,5);
elsif rising_edge(clk) then
case State is
when 0 => Xin <= to_signed(1030,5);
when 1 => Xin <= to_signed(1050,5);
when 2 => Xin <= to_signed(1040,5);
when 3 => Xin <= to_signed(1080,5);
when 4 => Xin <= to_signed(1100,5);
when others => Xin <= to_signed(0,5);
end case;
State <= State + 1;
end if;
end process;
rst
中的重置可以立即生效,并重复进行。
根据您需要的时间,可能需要对上述内容进行小幅更新,但按照此行编写的代码应该可以完成工作。
顺便说一句。将值 1030 to_signed
转换为 5 位 Xin
看起来很奇怪,因为 1030 的值至少需要 12 位来表示有符号。