diff --git a/src/hdl/modules/qlaser_dacs_pulse_channel.vhdl b/src/hdl/modules/qlaser_dacs_pulse_channel.vhdl index 8013bbc..3cc2ce1 100644 --- a/src/hdl/modules/qlaser_dacs_pulse_channel.vhdl +++ b/src/hdl/modules/qlaser_dacs_pulse_channel.vhdl @@ -286,10 +286,10 @@ begin -- Output waveform from RAM , and increment the address -- TODO: apply scaling factor to the address and then to the output ram_waveform_addrb <= std_logic_vector(unsigned(ram_waveform_addrb) + 1); - sm_wavedata <= ram_waveform_doutb; - sm_wavedata_dv <= '1'; - - end if; + end if; + sm_wavedata <= ram_waveform_doutb; + sm_wavedata_dv <= '1'; + ------------------------------------------------------------------------ -- Hold the last address and output its data -- decrement from this address when finished waiting @@ -299,33 +299,35 @@ begin sm_state <= S_WAVE_DOWN; else cnt_wave_top <= std_logic_vector(unsigned(cnt_wave_top) + 1); - sm_wavedata <= ram_waveform_doutb; - sm_wavedata_dv <= '1'; - end if; + end if; + sm_wavedata <= ram_waveform_doutb; + sm_wavedata_dv <= '1'; + ------------------------------------------------------------------------ -- Output the falling edge of a waveform -- Hold the start address when complete ------------------------------------------------------------------------ when S_WAVE_DOWN => + -- End of waveform? - if (ram_waveform_addrb = v_addr_start) then + if (ram_waveform_addrb = v_addr_start) then - -- If the end of the pulse table is reached then go to idle - if (ram_pulse_addrb = std_logic_vector(to_unsigned(C_NUM_PULSE-1,4))) then - ram_pulse_addrb <= (others=>'0'); - sm_state <= S_IDLE; + -- If the end of the pulse table is reached then go to idle + if (ram_pulse_addrb = std_logic_vector(to_unsigned(C_NUM_PULSE-1,4))) then + ram_pulse_addrb <= (others=>'0'); + sm_state <= S_IDLE; - else -- increment pulse address for the next waveform - ram_pulse_addrb <= std_logic_vector(unsigned(ram_pulse_addrb) + 1); - sm_state <= S_WAIT; + else -- increment pulse address for the next waveform + ram_pulse_addrb <= std_logic_vector(unsigned(ram_pulse_addrb) + 1); + sm_state <= S_WAIT; + end if; + + -- Output waveform from RAM with decremented address + else + ram_waveform_addrb <= std_logic_vector(unsigned(ram_waveform_addrb) - 1); end if; - - -- Output waveform from RAM with decremented address - else - ram_waveform_addrb <= std_logic_vector(unsigned(ram_waveform_addrb) - 1); sm_wavedata <= ram_waveform_doutb; sm_wavedata_dv <= '1'; - end if; ------------------------------------------------------------------------ -- Default