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

non-tabifying

parent 475932c2
...@@ -24,17 +24,17 @@ end entity; ...@@ -24,17 +24,17 @@ end entity;
architecture syn of DacsController is architecture syn of DacsController is
--! computes least possible width of the vector to store value X --! computes least possible width of the vector to store value X
-- http://stackoverflow.com/a/12751341/615627 -- http://stackoverflow.com/a/12751341/615627
function log2(X: positive) return natural is function log2(X: positive) return natural is
variable Result: natural; variable Result: natural;
begin begin
Result := 0; Result := 0;
while (2**Result < X) loop while (2**Result < X) loop
Result := Result + 1; Result := Result + 1;
end loop; end loop;
return Result; return Result;
end function; end function;
function f_calculateSclkDivsel(ClkFrequency, DacFrequencyMax: positive) return std_logic_vector is function f_calculateSclkDivsel(ClkFrequency, DacFrequencyMax: positive) return std_logic_vector is
variable Result: integer; variable Result: integer;
......
...@@ -2,40 +2,40 @@ library ieee; ...@@ -2,40 +2,40 @@ library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_1164.all;
entity ResetSyncer is entity ResetSyncer is
generic ( generic (
g_Length: integer := 3; g_Length: integer := 3;
g_Inverted: boolean := FALSE g_Inverted: boolean := FALSE
); );
port ( port (
Clk_ik: in std_logic; Clk_ik: in std_logic;
Reset_ira: in std_logic; Reset_ira: in std_logic;
Reset_or: out std_logic Reset_or: out std_logic
); );
end entity; end entity;
architecture syn of ResetSyncer is architecture syn of ResetSyncer is
function if_sl(condition: boolean; pos: std_logic; neg: std_logic) return std_logic is begin function if_sl(condition: boolean; pos: std_logic; neg: std_logic) return std_logic is begin
if condition then if condition then
return pos; return pos;
else else
return neg; return neg;
end if; end if;
end function; end function;
attribute ASYNC_REG: string; attribute ASYNC_REG: string;
attribute KEEP:string; attribute KEEP:string;
attribute SHREG_EXTRACT: string; attribute SHREG_EXTRACT: string;
constant c_Inversion: std_logic := if_sl(g_Inverted, '1', '0'); constant c_Inversion: std_logic := if_sl(g_Inverted, '1', '0');
signal ShiftRegister0: std_logic := ('1' xor c_Inversion); signal ShiftRegister0: std_logic := ('1' xor c_Inversion);
signal ShiftRegister1: std_logic := ('1' xor c_Inversion); signal ShiftRegister1: std_logic := ('1' xor c_Inversion);
signal ShiftRegister2: std_logic := ('1' xor c_Inversion); signal ShiftRegister2: std_logic := ('1' xor c_Inversion);
attribute ASYNC_REG of ShiftRegister0: signal is "true"; attribute ASYNC_REG of ShiftRegister0: signal is "true";
attribute ASYNC_REG of ShiftRegister1: signal is "true"; attribute ASYNC_REG of ShiftRegister1: signal is "true";
attribute ASYNC_REG of ShiftRegister2: signal is "true"; attribute ASYNC_REG of ShiftRegister2: signal is "true";
attribute KEEP of ShiftRegister0: signal is "true"; attribute KEEP of ShiftRegister0: signal is "true";
attribute KEEP of ShiftRegister1: signal is "true"; attribute KEEP of ShiftRegister1: signal is "true";
attribute KEEP of ShiftRegister2: signal is "true"; attribute KEEP of ShiftRegister2: signal is "true";
...@@ -45,18 +45,18 @@ architecture syn of ResetSyncer is ...@@ -45,18 +45,18 @@ architecture syn of ResetSyncer is
begin begin
pSyncer: process (Clk_ik, Reset_ira) begin pSyncer: process (Clk_ik, Reset_ira) begin
if Reset_ira = ('1' xor c_Inversion) then if Reset_ira = ('1' xor c_Inversion) then
ShiftRegister0 <= ('1' xor c_Inversion); ShiftRegister0 <= ('1' xor c_Inversion);
ShiftRegister1 <= ('1' xor c_Inversion); ShiftRegister1 <= ('1' xor c_Inversion);
ShiftRegister2 <= ('1' xor c_Inversion); ShiftRegister2 <= ('1' xor c_Inversion);
elsif rising_edge(Clk_ik) then elsif rising_edge(Clk_ik) then
ShiftRegister0 <= ('0' xor c_Inversion); ShiftRegister0 <= ('0' xor c_Inversion);
ShiftRegister1 <= ShiftRegister0; ShiftRegister1 <= ShiftRegister0;
ShiftRegister2 <= ShiftRegister1; ShiftRegister2 <= ShiftRegister1;
end if; end if;
end process; end process;
Reset_or <= ShiftRegister2; Reset_or <= ShiftRegister2;
end architecture; end architecture;
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