Skip to content

Instantly share code, notes, and snippets.

@forensicgarlic
Created April 19, 2016 18:29
Show Gist options
  • Save forensicgarlic/fd53b44f02092fa54900f4804f0bb06d to your computer and use it in GitHub Desktop.
Save forensicgarlic/fd53b44f02092fa54900f4804f0bb06d to your computer and use it in GitHub Desktop.
VHDL converted from python automatically for euler problem 3
EULER3_A: process (clk, reset) is
begin
if (reset = '1') then
y <= to_unsigned(1, 64);
x <= to_unsigned(1, 64);
product <= to_unsigned(1, 64);
roots <= to_unsigned(1, 64);
elsif rising_edge(clk) then
if (bool(enable) and (not bool(results_valid_int))) then
if ((y mod x) = 0) then
roots <= x;
product <= resize(product * x, 64);
y <= (y / x);
else
x <= (x + 1);
end if;
elsif (not bool(enable)) then
roots <= to_unsigned(0, 64);
product <= to_unsigned(1, 64);
x <= to_unsigned(2, 64);
y <= max_value;
end if;
end if;
end process EULER3_A;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment