Line 26... |
Line 26... |
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
package powerGrid is
|
package powerGrid is
|
|
|
|
--A one stage pipe a+b+c with w width bits in input as well as output.
|
|
component p1ax
|
|
generic ( W : integer := 36 );
|
|
port ( clk : in std_logic;
|
|
rst : in std_logic;
|
|
enable : in std_logic;
|
|
dataa : in std_logic_vector(W-1 downto 0);
|
|
datab : in std_logic_vector(W-1 downto 0);
|
|
datac : in std_logic_vector(W-1 downto 0);
|
|
result : out std_logic_vector(W-1 downto 0)
|
|
);
|
|
end component;
|
|
|
|
-- A 1 stage pipe 18x18 multiplier. On Cycle III devices is a M-R (Multiplier, Register). (Should be generated using a synthesis tool....).
|
|
component p1m18
|
|
port (
|
|
aclr : in std_logic ;
|
|
clken : in std_logic ;
|
|
clock : in std_logic ;
|
|
dataa : in std_logic_vector (17 downto 0);
|
|
datab : in std_logic_vector (17 downto 0);
|
|
result : out std_logic_vector (35 downto 0)
|
|
);
|
|
end component;
|
|
|
-- Signed "less than"
|
-- Signed "less than"
|
component sl32
|
component sl32
|
port (
|
port (
|
dataa : in std_logic_vector (31 downto 0);
|
dataa : in std_logic_vector (31 downto 0);
|
datab : in std_logic_vector (31 downto 0);
|
datab : in std_logic_vector (31 downto 0);
|
Line 55... |
Line 80... |
port (
|
port (
|
clk : in std_logic;
|
clk : in std_logic;
|
rst : in std_logic;
|
rst : in std_logic;
|
|
|
cIdd : in std_logic_vector (idColW - 1 downto 0); -- This is the reference column identification input.
|
cIdd : in std_logic_vector (idColW - 1 downto 0); -- This is the reference column identification input.
|
cIdq : out std_logic_vector (idColW - 1 downto 0); -- This is the sphere identification output.
|
cIdq : out std_logic_vector (idColW - 1 downto 0); -- This is the result column identification output.
|
refvd : in std_logic_vector (W - 1 downto 0); -- This is the projection incoming from the previous cell.
|
refvd : in std_logic_vector (W - 1 downto 0); -- This is the reference projection incoming from the previous cell.
|
colvd : in std_logic_vector (W - 1 downto 0); -- This is the projection of the sphere position over the ray traced vector, a.k.a. V.D! .
|
colvd : in std_logic_vector (W - 1 downto 0); -- This is the sphere position over the ray traced vector projection.
|
selvd : out std_logic_vector (W - 1 downto 0) -- This is the smallest value between refvd and colvd.
|
selvd : out std_logic_vector (W - 1 downto 0) -- This is the smallest value between refvd and colvd.
|
)
|
);
|
end component;
|
end component;
|
|
|
-- Dot Product Calculation.
|
-- Dot Product Calculation Cell.
|
|
-- A 4 side cell along with an upper side.
|
|
-- V input flows through V output using a data flipflop, so turning V output in the next cell on the next row V Input. V input also flows upwards into the dotproduct 3 stage pipeline.
|
|
-- D input flows through D output using a data flipflop, so turning D output in the next column cell. D input also flows upwards into the dotproduct 3 stage.
|
component dotCell
|
component dotCell
|
generic ( levelW : integer := 18; -- Actual Level Width
|
generic ( levelW : integer := 18; -- Actual Level Width
|
nLevelW : integer := 32); -- Next Level Width
|
nLevelW : integer := 32); -- Next Level Width
|
port (
|
port (
|
clk : in std_logic;
|
clk : in std_logic;
|
rst : in std_logic;
|
rst : in std_logic;
|
|
|
-- Object control.
|
-- Object control.
|
nxtSphere : in std_logic; -- This bit controls when the sphere center goes to the next row.
|
nxtSphere : in std_logic; -- This bit controls when the sphere center goes to the next row.
|
|
nxtRay : in std_logic; -- This bit controls when the ray goes to the next column.
|
|
|
-- First Side.
|
-- First Side.
|
vxInput : in std_logic_vector(levelW-1 downto 0);
|
vxInput : in std_logic_vector(levelW-1 downto 0);
|
vyInput : in std_logic_vector(levelW-1 downto 0);
|
vyInput : in std_logic_vector(levelW-1 downto 0);
|
vzInput : in std_logic_vector(levelW-1 downto 0);
|
vzInput : in std_logic_vector(levelW-1 downto 0);
|
|
|
Line 93... |
Line 123... |
dxOutput : in std_logic_vector(levelW-1 downto 0);
|
dxOutput : in std_logic_vector(levelW-1 downto 0);
|
dyOutput : in std_logic_vector(levelW-1 downto 0);
|
dyOutput : in std_logic_vector(levelW-1 downto 0);
|
dzOutput : in std_logic_vector(levelW-1 downto 0);
|
dzOutput : in std_logic_vector(levelW-1 downto 0);
|
|
|
--Fifth Side (Going to the floor right upstairs!)
|
--Fifth Side (Going to the floor right upstairs!)
|
vdOutput : out std_logic_vector(nLevelW-1 downto 0); -- Dot product.
|
vdOutput : out std_logic_vector(nLevelW-1 downto 0) -- Dot product.
|
|
|
);
|
);
|
end component;
|
end component;
|
|
|
-- K discriminant comparison.
|
-- K discriminant comparison.
|
component kComparisonCell
|
component kComparisonCell
|
generic ( W : integer := 32;
|
generic ( W : integer := 32;
|
idW : integer := 12
|
|
);
|
);
|
port (
|
port (
|
clk : in std_logic;
|
clk : in std_logic;
|
rst : in std_logic;
|
rst : in std_logic;
|
|
|
nxtRow : in std_logic; -- Controls when the sphere goes to the next Row.
|
nxtRow : in std_logic; -- Controls when the sphere goes to the next Row.
|
|
|
vdinput : in std_logic_vector (W-1 downto 0);
|
vdinput : in std_logic_vector (W-1 downto 0);
|
kinput : in std_logic_vector (W-1 downto 0);
|
kinput : in std_logic_vector (W-1 downto 0);
|
koutput : out std_logic_vector (W-1 downto 0);
|
koutput : out std_logic_vector (W-1 downto 0);
|
|
|
sDP : out std_logic_vector (W-1 downto 0) -- Selected dot product.
|
sDP : out std_logic_vector (W-1 downto 0) -- Selected dot product.
|
|
|
|
|
);
|
);
|
end component;
|
end component;
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|
|
end powerGrid;
|
No newline at end of file
|
No newline at end of file
|