Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
entity fpu is | ||
port ( | ||
clk : in std_ulogic; | ||
addr : in std_ulogic_vector(1 downto 0); | ||
inverse_est : out std_ulogic_vector(17 downto 0) | ||
); | ||
end entity fpu; | ||
|
||
architecture behaviour of fpu is | ||
type lookup_table is array(0 to 3) of std_ulogic_vector(17 downto 0); | ||
|
||
signal inverse_table : lookup_table := ( | ||
18x"3fc01", 18x"3f411", 18x"3ec31", 18x"3e460" | ||
); | ||
begin | ||
lut_access: process(clk) | ||
begin | ||
if rising_edge(clk) then | ||
inverse_est <= inverse_table(to_integer(unsigned(addr))); | ||
end if; | ||
end process; | ||
|
||
end architecture behaviour; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
entity fpu is | ||
port ( | ||
clk : in std_ulogic; | ||
addr : in std_ulogic_vector(1 downto 0); | ||
inverse_est : out std_ulogic_vector(17 downto 0) | ||
); | ||
end entity fpu; | ||
|
||
architecture behaviour of fpu is | ||
type lookup_table is array(0 to 3) of std_ulogic_vector(17 downto 0); | ||
|
||
constant inverse_table : lookup_table := ( | ||
18x"3fc01", 18x"3f411", 18x"3ec31", 18x"3e460" | ||
); | ||
begin | ||
lut_access: process(clk) | ||
begin | ||
if rising_edge(clk) then | ||
inverse_est <= inverse_table(to_integer(unsigned(addr))); | ||
end if; | ||
end process; | ||
|
||
end architecture behaviour; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
topdir=../.. | ||
. $topdir/testenv.sh | ||
|
||
for f in fpu fpu2; do | ||
synth_import "--std=08 ${f}.vhdl -e" | ||
done | ||
|
||
echo OK |