VHDL序列器:在FSM中递增输出信号

VHDL序列器:在FSM中递增输出信号,vhdl,fsm,Vhdl,Fsm,我正在研究一个定序器,我不知道如何增加一些输出信号。在状态1(S1)中,我希望(在每个时钟周期上)增加ram\u add\u wr clocked_进程:进程(时钟、rst) 变量计数:整数范围0到32; 开始 如果(rst='0'),则 pr_state您可以使用两个计数器寄存器 ... signal cntReg, cntReg_next: integer range 0 to 31 := 0; begin -- Clocked process -- ...

我正在研究一个定序器,我不知道如何增加一些输出信号。在状态1(
S1
)中,我希望(在每个时钟周期上)增加
ram\u add\u wr

clocked_进程:进程(时钟、rst)
变量计数:整数范围0到32;
开始
如果(rst='0'),则

pr_state您可以使用两个计数器寄存器

   ...
   signal cntReg, cntReg_next: integer range 0 to 31 := 0;

begin

   -- Clocked process --
   ...
   elsif (clk'event and clk='1') then
       if (pr_state = s1) then
           cntReg <= cntReg_next;
       end if;
       ...
   ...


   -- Combined process --
   ...
   when s1 =>
      cntReg_next <= cntReg + 1;
   ...

   -- output (depends on the type of sig_ram_add_wr)
   sig_ram_add_wr <= std_logic_vector(to_unsigned(cntReg, 5));  
。。。
信号cntReg,cntReg_next:整数范围0到31:=0;
开始
--计时进程--
...
elsif(clk'事件和clk='1'),然后
如果(pr_状态=s1),则
cntReg

cntReg_next无需单独处理-执行以下操作:

clocked_process:PROCESS(clk,rst)

    VARIABLE count: INTEGER RANGE 0 TO 32;
    variable addr : unsigned(sig_ram_add_wr'range);
BEGIN  

      IF rst = '0' THEN  
          ...
          addr := (others => '0';
      ELSIF rising_edge(clk) THEN    
          ...
          if pr_state = s1 then
             addr := addr + 1; -- update the address counter here
          end if;
          ...
      END IF;
      sig_ram_add_wr <= std_logic_vector(addr); -- copy it onto the output pins here - as this is outside the clocked element, the synthesiser will just create a wire
END PROCESS;        
clocked_进程:进程(时钟、rst)
变量计数:整数范围0到32;
变量addr:无符号(sig_ram_add_wr'范围);
开始
如果rst='0',则
...
地址:=(其他=>'0';
ELSIF上升沿(clk)则
...
如果pr_state=s1,则
addr:=addr+1;--在此处更新地址计数器
如果结束;
...
如果结束;
信号ram添加wr
clocked_process:PROCESS(clk,rst)

    VARIABLE count: INTEGER RANGE 0 TO 32;
    variable addr : unsigned(sig_ram_add_wr'range);
BEGIN  

      IF rst = '0' THEN  
          ...
          addr := (others => '0';
      ELSIF rising_edge(clk) THEN    
          ...
          if pr_state = s1 then
             addr := addr + 1; -- update the address counter here
          end if;
          ...
      END IF;
      sig_ram_add_wr <= std_logic_vector(addr); -- copy it onto the output pins here - as this is outside the clocked element, the synthesiser will just create a wire
END PROCESS;