Commit 8a352bca authored by Tristan Gingold's avatar Tristan Gingold

vtuCore: add comments, simplify the HDL.

parent 31b66a77
...@@ -528,11 +528,17 @@ entity vtuDataShifter is ...@@ -528,11 +528,17 @@ entity vtuDataShifter is
-- Avoid pulses between two words -- Avoid pulses between two words
); );
port (CoarseZero : out std_logic; port (CoarseZero : out std_logic;
DataOut : out std_logic_vector(7 downto 0 );
-- Data output, provided 1 clock cycle after DataIn.
-- The first bit to generate is the MSB.
DataOut : out std_logic_vector(7 downto 0);
OutputEnabled : out std_logic; OutputEnabled : out std_logic;
Clk : in std_logic; Clk : in std_logic;
Delay : in std_logic_vector(N - 1 downto 0 ); Delay : in std_logic_vector(N - 1 downto 0 );
DataIn : in std_logic_vector(7 downto 0 );
-- Input data. The first bit is the MSB.
DataIn : in std_logic_vector(7 downto 0);
Enabled : in std_logic; Enabled : in std_logic;
SyncPulse : out std_logic); SyncPulse : out std_logic);
end vtuDataShifter; end vtuDataShifter;
...@@ -554,7 +560,6 @@ architecture vtuDataShifter of vtuDataShifter is ...@@ -554,7 +560,6 @@ architecture vtuDataShifter of vtuDataShifter is
signal Sync_i : std_logic; signal Sync_i : std_logic;
signal OutGood : std_logic; signal OutGood : std_logic;
signal Disabled : std_logic; signal Disabled : std_logic;
signal DataRaw : std_logic_vector(15 downto 0 );
signal CoarseZero_i : std_logic; signal CoarseZero_i : std_logic;
signal UseNextValue : std_logic; signal UseNextValue : std_logic;
signal FineDly : std_logic_vector(2 downto 0 ); signal FineDly : std_logic_vector(2 downto 0 );
...@@ -647,14 +652,12 @@ begin ...@@ -647,14 +652,12 @@ begin
OutputEnabled_i <= OutMuxSel and (not Disabled); OutputEnabled_i <= OutMuxSel and (not Disabled);
OutputEnabled <= OutputEnabled_i; OutputEnabled <= OutputEnabled_i;
DataRaw(15 downto 8) <= DataClean; -- Prepare next data output: delay by FineDly.
DataRaw(7 downto 0) <= (others => '0'); ShiftReg_proc: process (DataClean, FineDly)
-- Prepare next data output.
ShiftReg_proc: process (DataRaw, FineDly)
variable DataOut_aux : std_logic_vector(15 downto 0); variable DataOut_aux : std_logic_vector(15 downto 0);
begin begin
DataOut_aux := std_logic_vector(shift_right(unsigned(DataRaw), to_integer(unsigned(FineDly)))); -- Delay by FineDly. Because the first bit is the MSB, do a right shift.
DataOut_aux := std_logic_vector(shift_right(unsigned(DataClean & x"00"), to_integer(unsigned(FineDly))));
if DataOut_aux(7 downto 0) = (7 downto 0 => '0') then if DataOut_aux(7 downto 0) = (7 downto 0 => '0') then
DataOut_i <= DataOut_aux(15 downto 8); DataOut_i <= DataOut_aux(15 downto 8);
-- Need to wait one cycle. -- Need to wait one cycle.
...@@ -948,57 +951,29 @@ architecture ModeSelDecoder of ModeSelDecoder is ...@@ -948,57 +951,29 @@ architecture ModeSelDecoder of ModeSelDecoder is
begin begin
process (Mode) process (Mode)
begin begin
SinglePulseMode <= '0';
if (Mode = C_Code_ctuAsVtu_control2_mode_singlePulse) then InfiniteWindowMode <= '0';
SinglePulseMode <= '1'; WindowedOperationMode <= '0';
InfiniteWindowMode <= '0'; SyncLessOperationMode <= '0';
WindowedOperationMode <= '0'; LowFreqGenerationMode <= '0';
SyncLessOperationMode <= '0'; PlayMemoryMode <= '0';
LowFreqGenerationMode <= '0';
PlayMemoryMode <= '0'; case Mode is
elsif (Mode = C_Code_ctuAsVtu_control2_mode_infiniteWindow) then when C_Code_ctuAsVtu_control2_mode_singlePulse =>
SinglePulseMode <= '0'; SinglePulseMode <= '1';
InfiniteWindowMode <= '1'; when C_Code_ctuAsVtu_control2_mode_infiniteWindow =>
WindowedOperationMode <= '0'; InfiniteWindowMode <= '1';
SyncLessOperationMode <= '0'; when C_Code_ctuAsVtu_control2_mode_windowedOperation =>
LowFreqGenerationMode <= '0'; WindowedOperationMode <= '1';
PlayMemoryMode <= '0'; when C_Code_ctuAsVtu_control2_mode_syncLessOperation =>
elsif (Mode = C_Code_ctuAsVtu_control2_mode_windowedOperation) then SyncLessOperationMode <= '1';
SinglePulseMode <= '0'; when C_Code_ctuAsVtu_control2_mode_lowFreqGeneration =>
InfiniteWindowMode <= '0'; LowFreqGenerationMode <= '1';
WindowedOperationMode <= '1'; when C_Code_ctuAsVtu_control2_mode_playMemory =>
SyncLessOperationMode <= '0'; PlayMemoryMode <= '1';
LowFreqGenerationMode <= '0'; when others =>
PlayMemoryMode <= '0'; null;
elsif (Mode = C_Code_ctuAsVtu_control2_mode_syncLessOperation) then end case;
SinglePulseMode <= '0';
InfiniteWindowMode <= '0';
WindowedOperationMode <= '0';
SyncLessOperationMode <= '1';
LowFreqGenerationMode <= '0';
PlayMemoryMode <= '0';
elsif (Mode = C_Code_ctuAsVtu_control2_mode_lowFreqGeneration) then
SinglePulseMode <= '0';
InfiniteWindowMode <= '0';
WindowedOperationMode <= '0';
SyncLessOperationMode <= '0';
LowFreqGenerationMode <= '1';
PlayMemoryMode <= '0';
elsif (Mode = C_Code_ctuAsVtu_control2_mode_playMemory) then
SinglePulseMode <= '0';
InfiniteWindowMode <= '0';
WindowedOperationMode <= '0';
SyncLessOperationMode <= '0';
LowFreqGenerationMode <= '0';
PlayMemoryMode <= '1';
else
SinglePulseMode <= '0';
InfiniteWindowMode <= '0';
WindowedOperationMode <= '0';
SyncLessOperationMode <= '0';
LowFreqGenerationMode <= '0';
PlayMemoryMode <= '0';
end if ;
end process; end process;
end ModeSelDecoder; end ModeSelDecoder;
......
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