Commit 8e25fb8d authored by Jan Pospisil's avatar Jan Pospisil

fixed ONE-SHOT issue (when overflow < trigger periodicity)

parent dbefc491
......@@ -29,8 +29,7 @@ architecture syn of Fsm is
s_Stop,
s_WaitForTrigger,
s_Generating,
s_Outputting,
s_WaitForEnd
s_Outputting
);
function f_State2Unsigned (State: t_State) return unsigned is begin
......@@ -70,11 +69,7 @@ begin
State <= s_Outputting;
end if;
when s_Outputting =>
if (Trigger_i = '1') and (Mode_i = e_ModeSingle) then
State <= s_WaitForEnd;
end if;
when s_WaitForEnd =>
if StreamReset_i = '1' then
if (StreamReset_i = '1') and (Mode_i = e_ModeSingle) then
State <= s_Stop;
end if;
when others =>
......@@ -99,10 +94,6 @@ begin
Running_o <= '1';
GenerationEnable_o <= '1';
OutputEnable_o <= '1';
when s_WaitForEnd =>
Running_o <= '1';
GenerationEnable_o <= '1';
OutputEnable_o <= '1';
when others => null;
end case;
end process;
......
......@@ -344,6 +344,12 @@ def Start(channel):
channel *= 2
WbSetBits('control', 0x30<<channel, 0x10<<channel) # set mode CONT.
def StartOnce(channel):
channel -= 1
channel %= 2
channel *= 2
WbSetBits('control', 0x30<<channel, 0x20<<channel) # set mode ONE-SHOT
def Stop(channel):
channel -= 1
channel %= 2
......@@ -353,8 +359,8 @@ def Stop(channel):
def Debug():
print('Debug:')
debug = WbRead('debug')
PrintBits(debug, 0, 2, "CH1 FSM state", ("Stop", "WaitForTrigger", "Generating", "Outputting", "WaitForEnd"))
PrintBits(debug, 3, 5, "CH2 FSM state", ("Stop", "WaitForTrigger", "Generating", "Outputting", "WaitForEnd"))
PrintBits(debug, 0, 2, "CH1 FSM state", ("Stop", "WaitForTrigger", "Generating", "Outputting"))
PrintBits(debug, 3, 5, "CH2 FSM state", ("Stop", "WaitForTrigger", "Generating", "Outputting"))
###################################################################
## Test functions
......@@ -374,9 +380,9 @@ def TestPulse(channel = 1):
WbWrite('overflow', 17820)
WbWrite('trig_latency', 8)
start = 5
length = 20
stop = start + length
# start = 5
# length = 20
# stop = start + length
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
# start += 1
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
......@@ -386,21 +392,22 @@ def TestPulse(channel = 1):
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
# start += 1
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
CreatePulse(channel, 10, 20)
CreatePulse(channel, 11, 21)
CreatePulse(channel, 12, 22)
CreatePulse(channel, 13, 23)
CreatePulse(channel, 14, 24)
# CreatePulse(channel, 5, 10)
# CreatePulse(channel, 25, 30)
# CreatePulse(channel, 125, 130)
# CreatePulse(channel, 10, 20)
# CreatePulse(channel, 11, 21)
# CreatePulse(channel, 12, 22)
# CreatePulse(channel, 13, 23)
# CreatePulse(channel, 14, 24)
CreatePulse(channel, 5, 10)
CreatePulse(channel, 20, 50)
CreatePulse(channel, 100, 300)
WbWrite('ch'+str(channel)+'_delay_set', 100)
WbWrite('ch'+str(channel)+'_delay_res', 500)
Enable(channel)
Start(channel)
StartOnce(channel)
Init()
Control()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment