--! @file raytrac.vhd
|
--! @file raytrac.vhd
|
--! @brief Sistema de Procesamiento Vectorial. La interface es compatible con el bus Avalon de Altera.
|
--! @brief Sistema de Procesamiento Vectorial. La interface es compatible con el bus Avalon de Altera.
|
--! @author Julián Andrés Guarín Reyes
|
--! @author Julián Andrés Guarín Reyes
|
--------------------------------------------------------------
|
--------------------------------------------------------------
|
-- RAYTRAC
|
-- RAYTRAC
|
-- Author Julian Andres Guarin
|
-- Author Julian Andres Guarin
|
-- raytrac.vhd
|
-- raytrac.vhd
|
-- This file is part of raytrac.
|
-- This file is part of raytrac.
|
--
|
--
|
-- raytrac is free software: you can redistribute it and/or modify
|
-- raytrac is free software: you can redistribute it and/or modify
|
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
-- the Free Software Foundation, either version 3 of the License, or
|
-- the Free Software Foundation, either version 3 of the License, or
|
-- (at your option) any later version.
|
-- (at your option) any later version.
|
--
|
--
|
-- raytrac is distributed in the hope that it will be useful,
|
-- raytrac is distributed in the hope that it will be useful,
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
-- MERCHANTABILITY or FITNESS FOR a PARTICULAR PURPOSE. See the
|
-- MERCHANTABILITY or FITNESS FOR a PARTICULAR PURPOSE. See the
|
-- GNU General Public License for more details.
|
-- GNU General Public License for more details.
|
--
|
--
|
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
-- along with raytrac. If not, see <http://www.gnu.org/licenses/>.
|
-- along with raytrac. If not, see <http://www.gnu.org/licenses/>.
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use work.arithpack.all;
|
use work.arithpack.all;
|
|
|
library altera_mf;
|
library altera_mf;
|
use altera_mf.altera_mf_components.all;
|
use altera_mf.altera_mf_components.all;
|
|
|
library lpm;
|
library lpm;
|
use lpm.lpm_components.all;
|
use lpm.lpm_components.all;
|
|
|
|
|
entity raytrac is
|
entity raytrac is
|
generic (
|
generic (
|
wd : integer := 32;
|
wd : integer := 32;
|
fd : integer := 8; --! Result Fifo Depth = 2**fd =256
|
fd : integer := 8; --! Result Fifo Depth = 2**fd =256
|
mb : integer := 4 --! Max Burst Length = 2**mb
|
mb : integer := 4 --! Max Burst Length = 2**mb
|
);
|
);
|
port (
|
port (
|
clk: in std_logic;
|
clk: in std_logic;
|
rst: in std_logic;
|
rst: in std_logic;
|
|
|
--! Avalon MM Slave
|
--! Avalon MM Slave
|
slave_address : in std_logic_vector(3 downto 0);
|
slave_address : in std_logic_vector(3 downto 0);
|
slave_read : in std_logic;
|
slave_read : in std_logic;
|
slave_write : in std_logic;
|
slave_write : in std_logic;
|
slave_readdata : out std_logic_vector(31 downto 0);
|
slave_readdata : out std_logic_vector(31 downto 0);
|
slave_writedata : in std_logic_vector(31 downto 0);
|
slave_writedata : in std_logic_vector(31 downto 0);
|
|
|
--! Avalon MM Master (Read & Write common signals)
|
--! Avalon MM Master (Read & Write common signals)
|
master_address : out std_logic_vector(31 downto 0);
|
master_address : out std_logic_vector(31 downto 0);
|
master_burstcount : out std_logic_vector(4 downto 0);
|
master_burstcount : out std_logic_vector(4 downto 0);
|
master_waitrequest : in std_logic;
|
master_waitrequest : in std_logic;
|
|
|
--! Avalon MM Master (Read Stage)
|
--! Avalon MM Master (Read Stage)
|
master_read : out std_logic;
|
master_read : out std_logic;
|
master_readdata : in std_logic_vector(31 downto 0);
|
master_readdata : in std_logic_vector(31 downto 0);
|
master_readdatavalid : in std_logic;
|
master_readdatavalid : in std_logic;
|
|
|
--! Avalon MM Master (Write Stage)
|
--! Avalon MM Master (Write Stage)
|
master_write : out std_logic;
|
master_write : out std_logic;
|
master_writedata : out std_logic_vector(31 downto 0);
|
master_writedata : out std_logic_vector(31 downto 0);
|
|
|
--! Avalon IRQ
|
--! Avalon IRQ
|
irq : out std_logic
|
irq : out std_logic
|
|
|
|
|
|
|
);
|
);
|
end entity;
|
end entity;
|
|
|
|
|
architecture raytrac_arch of raytrac is
|
architecture raytrac_arch of raytrac is
|
|
|
|
|
--! Altera Compiler Directive, to avoid m9k autoinferring thanks to the guys at http://www.alteraforum.com/forum/archive/index.php/t-30784.html ....
|
--! Altera Compiler Directive, to avoid m9k autoinferring thanks to the guys at http://www.alteraforum.com/forum/archive/index.php/t-30784.html ....
|
attribute altera_attribute : string;
|
attribute altera_attribute : string;
|
attribute altera_attribute of raytrac_arch : architecture is "-name AUTO_SHIFT_REGISTER_RECOGNITION OFF";
|
attribute altera_attribute of raytrac_arch : architecture is "-name AUTO_SHIFT_REGISTER_RECOGNITION OFF";
|
|
|
|
|
type registerblock is array (15 downto 0) of xfloat32;
|
type registerblock is array (15 downto 0) of xfloat32;
|
type transferState is (IDLE,SINK,SOURCE);
|
type transferState is (IDLE,SINK,SOURCE);
|
type upload_chain is (UPVX,UPVY,UPVZ,SC,DMA);
|
type upload_chain is (UPVX,UPVY,UPVZ,SC,DMA);
|
type download_chain is (DWAX,DWAY,DWAZ,DWBX,DWBY,DWBZ,DWAXBX,DWAYBY,DWAZBZ);
|
type download_chain is (DWAX,DWAY,DWAZ,DWBX,DWBY,DWBZ,DWAXBX,DWAYBY,DWAZBZ);
|
|
|
constant reg_ctrl : integer:=00;
|
constant reg_ctrl : integer:=00;
|
constant reg_vz : integer:=01;
|
constant reg_vz : integer:=01;
|
constant reg_vy : integer:=02;
|
constant reg_vy : integer:=02;
|
constant reg_vx : integer:=03;
|
constant reg_vx : integer:=03;
|
constant reg_scalar : integer:=04;
|
constant reg_scalar : integer:=04;
|
constant reg_nfetch : integer:=05;
|
constant reg_nfetch : integer:=05;
|
constant reg_outputcounter : integer:=06;
|
constant reg_outputcounter : integer:=06;
|
constant reg_inputcounter : integer:=07;
|
constant reg_inputcounter : integer:=07;
|
constant reg_fetchstart : integer:=08;
|
constant reg_fetchstart : integer:=08;
|
constant reg_sinkstart : integer:=09;
|
constant reg_sinkstart : integer:=09;
|
constant reg_ax : integer:=10;
|
constant reg_ax : integer:=10;
|
constant reg_ay : integer:=11;
|
constant reg_ay : integer:=11;
|
constant reg_az : integer:=12;
|
constant reg_az : integer:=12;
|
constant reg_bx : integer:=13;
|
constant reg_bx : integer:=13;
|
constant reg_by : integer:=14;
|
constant reg_by : integer:=14;
|
constant reg_bz : integer:=15;
|
constant reg_bz : integer:=15;
|
|
|
|
|
|
|
constant reg_ctrl_cmb : integer:=00; --! CMB bit : Combinatorial Instruction.
|
constant reg_ctrl_cmb : integer:=00; --! CMB bit : Combinatorial Instruction.
|
constant reg_ctrl_s : integer:=01; --! S bit of the DCS field.
|
constant reg_ctrl_s : integer:=01; --! S bit of the DCS field.
|
constant reg_ctrl_c : integer:=02; --! C bit of the DCS field.
|
constant reg_ctrl_c : integer:=02; --! C bit of the DCS field.
|
constant reg_ctrl_d : integer:=03; --! D bit of the DCS field.
|
constant reg_ctrl_d : integer:=03; --! D bit of the DCS field.
|
|
|
constant reg_ctrl_sc : integer:=04; --! SC bit of the VTSC field.
|
constant reg_ctrl_sc : integer:=04; --! SC bit of the VTSC field.
|
constant reg_ctrl_vt : integer:=05; --! VT bit of the VTSC field.
|
constant reg_ctrl_vt : integer:=05; --! VT bit of the VTSC field.
|
constant reg_ctrl_dma : integer:=06; --! DMA bit.
|
constant reg_ctrl_dma : integer:=06; --! DMA bit.
|
constant reg_ctrl_flags_fc : integer:=07; --! Flood Condition Flag.
|
constant reg_ctrl_flags_fc : integer:=07; --! Flood Condition Flag.
|
|
|
constant reg_ctrl_flags_dc : integer:=08; --! Drain Condition Flag.
|
constant reg_ctrl_flags_dc : integer:=08; --! Drain Condition Flag.
|
constant reg_ctrl_flags_wp : integer:=09; --! Write on Memory Pending Flag.
|
constant reg_ctrl_flags_wp : integer:=09; --! Write on Memory Pending Flag.
|
constant reg_ctrl_flags_pp : integer:=10; --! Pipeline Pending Flag.
|
constant reg_ctrl_flags_pp : integer:=10; --! Pipeline Pending Flag.
|
constant reg_ctrl_flags_pl : integer:=11; --! Load Parameter Pending Flag.
|
constant reg_ctrl_flags_pl : integer:=11; --! Load Parameter Pending Flag.
|
|
|
constant reg_ctrl_flags_dp : integer:=12; --! Data Pending flag.
|
constant reg_ctrl_flags_dp : integer:=12; --! Data Pending flag.
|
constant reg_ctrl_flags_ap : integer:=13; --! Address Pending Flag.
|
constant reg_ctrl_flags_ap : integer:=13; --! Address Pending Flag.
|
constant reg_ctrl_rlsc : integer:=14; --! RLSC bit : Reload Load Sync Chain.
|
constant reg_ctrl_rlsc : integer:=14; --! RLSC bit : Reload Load Sync Chain.
|
constant reg_ctrl_rom : integer:=15; --! ROM bit : Read Only Mode bit.
|
constant reg_ctrl_rom : integer:=15; --! ROM bit : Read Only Mode bit.
|
|
|
constant reg_ctrl_alb : integer:=16; --! Conditional Writing. A<B.
|
constant reg_ctrl_alb : integer:=16; --! Conditional Writing. A<B.
|
constant reg_ctrl_aeb : integer:=17; --! A==B.
|
constant reg_ctrl_aeb : integer:=17; --! A==B.
|
constant reg_ctrl_ageb : integer:=18; --! A>=B.
|
constant reg_ctrl_ageb : integer:=18; --! A>=B.
|
constant reg_ctrl_irq : integer:=31; --! IRQ bit : Interrupt Request Signal.
|
constant reg_ctrl_irq : integer:=31; --! IRQ bit : Interrupt Request Signal.
|
|
|
--! Nfetch Reg Mask
|
--! Nfetch Reg Mask
|
constant reg_nfetch_high : integer:=11; --! NFETCH_HIGH : Higher bit to program the number of addresses to load in the interconnection.
|
constant reg_nfetch_high : integer:=11; --! NFETCH_HIGH : Higher bit to program the number of addresses to load in the interconnection.
|
|
|
|
|
--! Avalon MM Slave
|
--! Avalon MM Slave
|
|
|
signal sreg_block : registerblock;
|
signal sreg_block : registerblock;
|
signal sslave_read : std_logic;
|
signal sslave_read : std_logic;
|
signal sslave_write : std_logic;
|
signal sslave_write : std_logic;
|
signal sslave_writedata : std_logic_vector (wd-1 downto 0);
|
signal sslave_writedata : std_logic_vector (wd-1 downto 0);
|
signal sslave_address : std_logic_vector (3 downto 0);
|
signal sslave_address : std_logic_vector (3 downto 0);
|
signal sslave_waitrequest : std_logic;
|
signal sslave_waitrequest : std_logic;
|
|
|
--! Avalon MM Master
|
--! Avalon MM Master
|
signal smaster_write : std_logic;
|
signal smaster_write : std_logic;
|
signal smaster_read : std_logic;
|
signal smaster_read : std_logic;
|
|
|
--! State Machine and event signaling
|
--! State Machine and event signaling
|
signal sm : transferState;
|
signal sm : transferState;
|
|
|
signal sr_e : std_logic;
|
signal sr_e : std_logic;
|
signal sr_ack : std_logic;
|
signal sr_ack : std_logic;
|
signal soutb_ack : std_logic;
|
signal soutb_ack : std_logic;
|
|
|
|
|
|
|
signal soutb_d : std_logic_vector(wd-1 downto 0);
|
signal soutb_d : std_logic_vector(wd-1 downto 0);
|
|
|
|
|
signal soutb_w : std_logic;
|
signal soutb_w : std_logic;
|
|
|
signal soutb_e : std_logic;
|
signal soutb_e : std_logic;
|
signal soutb_ae : std_logic;
|
signal soutb_ae : std_logic;
|
signal soutb_af : std_logic;
|
signal soutb_af : std_logic;
|
signal soutb_usedw : std_logic_vector(fd-1 downto 0);
|
signal soutb_usedw : std_logic_vector(fd-1 downto 0);
|
|
|
signal ssync_chain_1 : std_logic;
|
signal ssync_chain_1 : std_logic;
|
|
|
signal ssync_chain_pending : std_logic;
|
signal ssync_chain_pending : std_logic;
|
signal sfetch_data_pending : std_logic;
|
signal sfetch_data_pending : std_logic;
|
signal sload_add_pending : std_logic;
|
signal sload_add_pending : std_logic;
|
signal spipeline_pending : std_logic;
|
signal spipeline_pending : std_logic;
|
signal swrite_pending : std_logic;
|
signal swrite_pending : std_logic;
|
signal sparamload_pending : std_logic;
|
signal sparamload_pending : std_logic;
|
signal sZeroTransit : std_logic;
|
signal sZeroTransit : std_logic;
|
|
|
|
|
--!Unload Control
|
--!Unload Control
|
signal supload_chain : upload_chain;
|
signal supload_chain : upload_chain;
|
signal supload_start : upload_chain;
|
signal supload_start : upload_chain;
|
|
|
--!Señales de apoyo:
|
--!Señales de apoyo:
|
signal zero : std_logic_vector(31 downto 0);
|
signal zero : std_logic_vector(31 downto 0);
|
|
|
--!High Register Bank Control Signals or AKA Load Sync Chain Control
|
--!High Register Bank Control Signals or AKA Load Sync Chain Control
|
signal sdownload_chain : download_chain;
|
signal sdownload_chain : download_chain;
|
signal sdownload_start : download_chain;
|
signal sdownload_start : download_chain;
|
signal srestart_chain : std_logic;
|
signal srestart_chain : std_logic;
|
--!State Machine Hysteresis Control Signals
|
--!State Machine Hysteresis Control Signals
|
signal sdrain_condition : std_logic;
|
signal sdrain_condition : std_logic;
|
signal sdrain_burstcount : std_logic_vector(mb downto 0);
|
signal sdrain_burstcount : std_logic_vector(mb downto 0);
|
signal sdata_fetch_counter : std_logic_vector(reg_nfetch_high downto 0);
|
signal sdata_fetch_counter : std_logic_vector(reg_nfetch_high downto 0);
|
signal sburstcount_sink : std_logic_vector(mb downto 0);
|
signal sburstcount_sink : std_logic_vector(mb downto 0);
|
|
|
signal sflood_condition : std_logic;
|
signal sflood_condition : std_logic;
|
signal sflood_burstcount : std_logic_vector(mb downto 0);
|
signal sflood_burstcount : std_logic_vector(mb downto 0);
|
|
|
|
signal sp0,sp1,sp2 : std_logic_vector(31 downto 0);
|
--! Arithmetic Pipeline and Data Path Control
|
--! Arithmetic Pipeline and Data Path Control
|
component ap_n_dpc
|
component ap_n_dpc
|
port (
|
port (
|
|
|
|
p0,p1,p2 : out std_logic_vector(31 downto 0);
|
clk : in std_logic;
|
clk : in std_logic;
|
rst : in std_logic;
|
rst : in std_logic;
|
ax : in std_logic_vector(31 downto 0);
|
ax : in std_logic_vector(31 downto 0);
|
ay : in std_logic_vector(31 downto 0);
|
ay : in std_logic_vector(31 downto 0);
|
az : in std_logic_vector(31 downto 0);
|
az : in std_logic_vector(31 downto 0);
|
bx : in std_logic_vector(31 downto 0);
|
bx : in std_logic_vector(31 downto 0);
|
by : in std_logic_vector(31 downto 0);
|
by : in std_logic_vector(31 downto 0);
|
bz : in std_logic_vector(31 downto 0);
|
bz : in std_logic_vector(31 downto 0);
|
vx : out std_logic_vector(31 downto 0);
|
vx : out std_logic_vector(31 downto 0);
|
vy : out std_logic_vector(31 downto 0);
|
vy : out std_logic_vector(31 downto 0);
|
vz : out std_logic_vector(31 downto 0);
|
vz : out std_logic_vector(31 downto 0);
|
sc : out std_logic_vector(31 downto 0);
|
sc : out std_logic_vector(31 downto 0);
|
ack : in std_logic;
|
ack : in std_logic;
|
empty : out std_logic;
|
empty : out std_logic;
|
dcs : in std_logic_vector(2 downto 0); --! Bit con el identificador del bloque AB vs CD e identificador del sub bloque (A/B) o (C/D).
|
dcs : in std_logic_vector(2 downto 0); --! Bit con el identificador del bloque AB vs CD e identificador del sub bloque (A/B) o (C/D).
|
sync_chain_1 : in std_logic; --! Señal de dato valido que se va por toda la cadena de sincronizacion.
|
sync_chain_1 : in std_logic; --! Señal de dato valido que se va por toda la cadena de sincronizacion.
|
pipeline_pending : out std_logic --! Señal para indicar si hay datos en el pipeline aritmético.
|
pipeline_pending : out std_logic --! Señal para indicar si hay datos en el pipeline aritmético.
|
);
|
);
|
end component;
|
end component;
|
|
|
--! Nets para la salida de la cola de resultados y entrada del multiplexor del upload state machine.
|
--! Nets para la salida de la cola de resultados y entrada del multiplexor del upload state machine.
|
signal svx,svy,svz,ssc : std_logic_vector(31 downto 0);
|
signal svx,svy,svz,ssc : std_logic_vector(31 downto 0);
|
|
|
begin
|
begin
|
|
|
--!Zero agreggate
|
--!Zero agreggate
|
zero <= (others => '0');
|
zero <= (others => '0');
|
|
|
|
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! ARITHMETIC PIPELINE AND DATA PATH INSTANTIATION => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => =>
|
--! ARITHMETIC PIPELINE AND DATA PATH INSTANTIATION => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => =>
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
|
|
--! Arithpipeline and Datapath Control Instance
|
--! Arithpipeline and Datapath Control Instance
|
arithmetic_pipeline_and_datapath_controller : ap_n_dpc
|
arithmetic_pipeline_and_datapath_controller : ap_n_dpc
|
port map (
|
port map (
|
|
p0 => sp0,
|
|
p1 => sp1,
|
|
p2 => sp2,
|
clk => clk,
|
clk => clk,
|
rst => rst,
|
rst => rst,
|
ax => sreg_block(reg_ax),
|
ax => sreg_block(reg_ax),
|
ay => sreg_block(reg_ay),
|
ay => sreg_block(reg_ay),
|
az => sreg_block(reg_az),
|
az => sreg_block(reg_az),
|
bx => sreg_block(reg_bx),
|
bx => sreg_block(reg_bx),
|
by => sreg_block(reg_by),
|
by => sreg_block(reg_by),
|
bz => sreg_block(reg_bz),
|
bz => sreg_block(reg_bz),
|
vx => svx,
|
vx => svx,
|
vy => svy,
|
vy => svy,
|
vz => svz,
|
vz => svz,
|
sc => ssc,
|
sc => ssc,
|
ack => sr_ack,
|
ack => sr_ack,
|
empty => sr_e,
|
empty => sr_e,
|
dcs => sreg_block(reg_ctrl)(reg_ctrl_d downto reg_ctrl_s),
|
dcs => sreg_block(reg_ctrl)(reg_ctrl_d downto reg_ctrl_s),
|
sync_chain_1 => ssync_chain_1,
|
sync_chain_1 => ssync_chain_1,
|
pipeline_pending => spipeline_pending
|
pipeline_pending => spipeline_pending
|
);
|
);
|
|
|
|
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! TRANSFER CONTROL RTL CODE
|
--! TRANSFER CONTROL RTL CODE
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
TRANSFER_CONTROL:
|
TRANSFER_CONTROL:
|
process(clk,rst,master_waitrequest,sm,soutb_ae,soutb_usedw,spipeline_pending,soutb_e,zero,soutb_af,sfetch_data_pending,sreg_block,sslave_write,sslave_address,sslave_writedata,ssync_chain_pending,smaster_read,smaster_write,sdata_fetch_counter,sload_add_pending,swrite_pending,sdownload_chain)
|
process(clk,rst,master_waitrequest,sm,soutb_ae,soutb_usedw,spipeline_pending,soutb_e,zero,soutb_af,sfetch_data_pending,sreg_block,sslave_write,sslave_address,sslave_writedata,ssync_chain_pending,smaster_read,smaster_write,sdata_fetch_counter,sload_add_pending,swrite_pending,sdownload_chain)
|
begin
|
begin
|
|
|
--! Conexióln a señales externas.
|
--! Conexióln a señales externas.
|
irq <= sreg_block(reg_ctrl)(reg_ctrl_irq);
|
irq <= sreg_block(reg_ctrl)(reg_ctrl_irq);
|
master_read <= smaster_read;
|
master_read <= smaster_read;
|
master_write <= smaster_write;
|
master_write <= smaster_write;
|
|
|
--! Direct Memory Access Selector.
|
--! Direct Memory Access Selector.
|
|
|
|
|
|
|
--! ZERO_TRANSIT: Cuando todos los elementos de sincronización están en cero menos la cola de sincronización de carga de parametros.
|
--! ZERO_TRANSIT: Cuando todos los elementos de sincronización están en cero menos la cola de sincronización de carga de parametros.
|
sZeroTransit <= not(sload_add_pending or sfetch_data_pending or spipeline_pending or swrite_pending);
|
sZeroTransit <= not(sload_add_pending or sfetch_data_pending or spipeline_pending or swrite_pending);
|
|
|
--! ELEMENTO DE SINCRONIZACION OUT QUEUE: Datos pendientes por cargar a la memoria a través de la interconexión
|
--! ELEMENTO DE SINCRONIZACION OUT QUEUE: Datos pendientes por cargar a la memoria a través de la interconexión
|
swrite_pending <= not(soutb_e);
|
swrite_pending <= not(soutb_e);
|
|
|
|
|
--! ELEMENTO DE SINCRONIZACION DESCARGA DE DATOS: Hay datos pendientes por descargar desde la memoria a través de la interconexión.
|
--! ELEMENTO DE SINCRONIZACION DESCARGA DE DATOS: Hay datos pendientes por descargar desde la memoria a través de la interconexión.
|
if sdata_fetch_counter=zero(reg_nfetch_high downto 0) then
|
if sdata_fetch_counter=zero(reg_nfetch_high downto 0) then
|
sfetch_data_pending <= '0';
|
sfetch_data_pending <= '0';
|
else
|
else
|
sfetch_data_pending <= '1';
|
sfetch_data_pending <= '1';
|
end if;
|
end if;
|
|
|
--! ELEMENTO DE SINCRONIZACION CARGA DE DIRECCIONES: Hay direcciones pendientes por cargar a la interconexión?
|
--! ELEMENTO DE SINCRONIZACION CARGA DE DIRECCIONES: Hay direcciones pendientes por cargar a la interconexión?
|
if sreg_block(reg_nfetch)(reg_nfetch_high downto 0)=zero(reg_nfetch_high downto 0) then
|
if sreg_block(reg_nfetch)(reg_nfetch_high downto 0)=zero(reg_nfetch_high downto 0) then
|
sload_add_pending <= '0';
|
sload_add_pending <= '0';
|
else
|
else
|
sload_add_pending <= '1';
|
sload_add_pending <= '1';
|
end if;
|
end if;
|
|
|
--! ELEMENTO DE SINCRONIZACION CARGA DE OPERANDOS: Se están cargando los operandos que serán operados en el pipeline aritmético.
|
--! ELEMENTO DE SINCRONIZACION CARGA DE OPERANDOS: Se están cargando los operandos que serán operados en el pipeline aritmético.
|
if sdownload_chain /= DWAX and sdownload_chain /= DWAXBX then
|
if sdownload_chain /= DWAX and sdownload_chain /= DWAXBX then
|
sparamload_pending <= '1';
|
sparamload_pending <= '1';
|
else
|
else
|
sparamload_pending <= '0';
|
sparamload_pending <= '0';
|
end if;
|
end if;
|
|
|
--! Se debe iniciar una transacción de descarga de datos desde la memoria externa?
|
--! Se debe iniciar una transacción de descarga de datos desde la memoria externa?
|
if soutb_af='0' and sload_add_pending='1' then
|
if soutb_af='0' and sload_add_pending='1' then
|
--! Flow Control : La saturación de la cola de resultados continuará si no está tan llena y además hay pendientes datos por ser descargados.
|
--! Flow Control : La saturación de la cola de resultados continuará si no está tan llena y además hay pendientes datos por ser descargados.
|
sflood_condition <= '1';
|
sflood_condition <= '1';
|
else
|
else
|
--! Flow Control : La saturación de la cola de resultados debe parar porque está casí llena.
|
--! Flow Control : La saturación de la cola de resultados debe parar porque está casí llena.
|
sflood_condition <= '0';
|
sflood_condition <= '0';
|
end if;
|
end if;
|
|
|
if sreg_block(reg_nfetch)(reg_nfetch_high downto mb)/=zero(reg_nfetch_high downto mb) then
|
if sreg_block(reg_nfetch)(reg_nfetch_high downto mb)/=zero(reg_nfetch_high downto mb) then
|
--! Flow Control: Si el número de descargas pendientes es mayor o igual al max burst length, entonces cargar max burst en el contador.
|
--! Flow Control: Si el número de descargas pendientes es mayor o igual al max burst length, entonces cargar max burst en el contador.
|
sflood_burstcount <= '1'&zero(mb-1 downto 0);
|
sflood_burstcount <= '1'&zero(mb-1 downto 0);
|
else
|
else
|
--! Flow Control: Si le número de descargas pendientes es inferior a Max Burst Count entonces cargar los bits menos significativos del registro de descargas pendientes.
|
--! Flow Control: Si le número de descargas pendientes es inferior a Max Burst Count entonces cargar los bits menos significativos del registro de descargas pendientes.
|
sflood_burstcount <= '0'&sreg_block(reg_nfetch)(mb-1 downto 0);
|
sflood_burstcount <= '0'&sreg_block(reg_nfetch)(mb-1 downto 0);
|
end if;
|
end if;
|
|
|
--! Se debe iniciar una transacción de carga de datos hacia la memoria externa?
|
--! Se debe iniciar una transacción de carga de datos hacia la memoria externa?
|
if soutb_ae='1' then
|
if soutb_ae='1' then
|
--! Flow Control : Cuando se esté drenando la cola de resultados, si la cola está casí vac&iaute;a, la longitud del burst serán los bits menos significativos del contador de la cola.
|
--! Flow Control : Cuando se esté drenando la cola de resultados, si la cola está casí vac&iaute;a, la longitud del burst serán los bits menos significativos del contador de la cola.
|
sdrain_burstcount <= soutb_usedw(mb downto 0);
|
sdrain_burstcount <= soutb_usedw(mb downto 0);
|
--! Flow Control: El drenado de datos continuará si el número de datos en la cola bajo y no hay datos transitando por el pipeline, ni datos pendientes por cargar desde la memoria.
|
--! Flow Control: El drenado de datos continuará si el número de datos en la cola bajo y no hay datos transitando por el pipeline, ni datos pendientes por cargar desde la memoria.
|
sdrain_condition <= not(sload_add_pending) and not(sfetch_data_pending) and not(spipeline_pending) and swrite_pending;
|
sdrain_condition <= not(sload_add_pending) and not(sfetch_data_pending) and not(spipeline_pending) and swrite_pending;
|
else
|
else
|
--! Flow Control: Cuando se esté drenando la cola de resultados, si la cola de tiene una cantidad de datos mayor al burst count entonces se hará una transacción de longitud equivalente al burst count.
|
--! Flow Control: Cuando se esté drenando la cola de resultados, si la cola de tiene una cantidad de datos mayor al burst count entonces se hará una transacción de longitud equivalente al burst count.
|
sdrain_burstcount <= '1'&zero(mb-1 downto 0);
|
sdrain_burstcount <= '1'&zero(mb-1 downto 0);
|
--! Flow Control: El drenado de datos continuará si el número de datos en la cola es mayor o igual a 2**mb O si hay muy pocos datos y no hay datos transitando por el pipeline.
|
--! Flow Control: El drenado de datos continuará si el número de datos en la cola es mayor o igual a 2**mb O si hay muy pocos datos y no hay datos transitando por el pipeline.
|
sdrain_condition <= '1';
|
sdrain_condition <= '1';
|
end if;
|
end if;
|
|
|
--! Restart param load chain
|
--! Restart param load chain
|
srestart_chain <= sreg_block(reg_ctrl)(reg_ctrl_irq) and sreg_block(reg_ctrl)(reg_ctrl_rlsc);
|
srestart_chain <= sreg_block(reg_ctrl)(reg_ctrl_irq) and sreg_block(reg_ctrl)(reg_ctrl_rlsc);
|
|
|
--! Data dumpster: Descaratar dato de upload una vez la interconexión haya enganchado el dato.
|
--! Data dumpster: Descaratar dato de upload una vez la interconexión haya enganchado el dato.
|
if sm=SINK and master_waitrequest='0' and smaster_write='1' then
|
if sm=SINK and master_waitrequest='0' and smaster_write='1' then
|
soutb_ack <= '1';
|
soutb_ack <= '1';
|
else
|
else
|
soutb_ack <= '0';
|
soutb_ack <= '0';
|
end if;
|
end if;
|
|
|
|
|
|
|
--! Flow Control State Machine.
|
--! Flow Control State Machine.
|
if rst=rstMasterValue then
|
if rst=rstMasterValue then
|
|
|
--! State Machine
|
--! State Machine
|
sm <= IDLE;
|
sm <= IDLE;
|
|
|
|
|
--! Master Write & Read Common Signals Reset Value
|
--! Master Write & Read Common Signals Reset Value
|
master_burstcount <= (others => '0');
|
master_burstcount <= (others => '0');
|
master_address <= (others => '0');
|
master_address <= (others => '0');
|
sdata_fetch_counter <= (others => '0');
|
sdata_fetch_counter <= (others => '0');
|
sburstcount_sink <= (others => '0');
|
sburstcount_sink <= (others => '0');
|
|
|
--! Master Read Only Signals Reset Value
|
--! Master Read Only Signals Reset Value
|
smaster_read <= '0';
|
smaster_read <= '0';
|
|
|
--! Master Write Only Signals
|
--! Master Write Only Signals
|
smaster_write <= '0';
|
smaster_write <= '0';
|
|
|
--! Reg Ctrl & Fetch address and writeaddress
|
--! Reg Ctrl & Fetch address and writeaddress
|
--! Sinking address
|
--! Sinking address
|
sreg_block(reg_sinkstart) <= (others => '0');
|
sreg_block(reg_sinkstart) <= (others => '0');
|
--! Sourcing address
|
--! Sourcing address
|
sreg_block(reg_fetchstart) <= (others => '0');
|
sreg_block(reg_fetchstart) <= (others => '0');
|
--! Control and Status Register
|
--! Control and Status Register
|
sreg_block(reg_ctrl) <= (others => '0');
|
sreg_block(reg_ctrl) <= (others => '0');
|
--! Contador Overall
|
--! Contador Overall
|
sreg_block(reg_inputcounter) <= (others => '0');
|
sreg_block(reg_inputcounter) <= (others => '0');
|
sreg_block(reg_outputcounter) <= (others => '0');
|
sreg_block(reg_outputcounter) <= (others => '0');
|
--! Address Fetch Counter
|
--! Address Fetch Counter
|
sreg_block(reg_nfetch) <= (others => '0');
|
sreg_block(reg_nfetch) <= (others => '0');
|
|
|
|
|
elsif clk'event and clk='1' then
|
elsif clk'event and clk='1' then
|
|
|
--! Nevermind the State, discount the incoming valid data counter.
|
--! Nevermind the State, discount the incoming valid data counter.
|
sdata_fetch_counter <= sdata_fetch_counter-master_readdatavalid;
|
sdata_fetch_counter <= sdata_fetch_counter-master_readdatavalid;
|
|
|
--! Debug Counter.
|
--! Debug Counter.
|
sreg_block(reg_inputcounter) <= sreg_block(reg_inputcounter) + master_readdatavalid;
|
sreg_block(reg_inputcounter) <= sreg_block(reg_inputcounter) + master_readdatavalid;
|
sreg_block(reg_outputcounter) <= sreg_block(reg_outputcounter) + soutb_ack;
|
sreg_block(reg_outputcounter) <= sreg_block(reg_outputcounter) + soutb_ack;
|
|
|
--! Flags
|
--! Flags
|
|
|
|
|
case sm is
|
case sm is
|
when SOURCE =>
|
when SOURCE =>
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! Flooding the pipeline ........
|
--! Flooding the pipeline ........
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
if smaster_read='0' then
|
if smaster_read='0' then
|
if sflood_condition = '1' then
|
if sflood_condition = '1' then
|
--! Flow Control: Hay suficiente espacio en el buffer de salida y hay descargas pendientes por hacer
|
--! Flow Control: Hay suficiente espacio en el buffer de salida y hay descargas pendientes por hacer
|
smaster_read <= '1';
|
smaster_read <= '1';
|
master_address <= sreg_block(reg_fetchstart);
|
master_address <= sreg_block(reg_fetchstart);
|
master_burstcount <= sflood_burstcount;
|
master_burstcount <= sflood_burstcount;
|
sdata_fetch_counter <= sdata_fetch_counter+sflood_burstcount-master_readdatavalid;
|
sdata_fetch_counter <= sdata_fetch_counter+sflood_burstcount-master_readdatavalid;
|
--! Context Saving:
|
--! Context Saving:
|
sreg_block(reg_fetchstart) <= sreg_block(reg_fetchstart) + (sflood_burstcount&"00");
|
sreg_block(reg_fetchstart) <= sreg_block(reg_fetchstart) + (sflood_burstcount&"00");
|
sreg_block(reg_nfetch)(reg_nfetch_high downto 0) <= sreg_block(reg_nfetch)(reg_nfetch_high downto 0) - sflood_burstcount;
|
sreg_block(reg_nfetch)(reg_nfetch_high downto 0) <= sreg_block(reg_nfetch)(reg_nfetch_high downto 0) - sflood_burstcount;
|
else
|
else
|
--! Flow Control : Cambiar al estado SINK, porque o está muy llena la cola de salida o no hay descargas pendientes por realizar.
|
--! Flow Control : Cambiar al estado SINK, porque o está muy llena la cola de salida o no hay descargas pendientes por realizar.
|
sm <= SINK;
|
sm <= SINK;
|
end if;
|
end if;
|
else --master_read=1;
|
else --master_read=1;
|
if master_waitrequest='0' then
|
if master_waitrequest='0' then
|
--! Las direcciones de lectura están cargadas. Terminar la transferencia.
|
--! Las direcciones de lectura están cargadas. Terminar la transferencia.
|
smaster_read <= '0';
|
smaster_read <= '0';
|
end if;
|
end if;
|
end if;
|
end if;
|
when SINK =>
|
when SINK =>
|
|
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! Draining the pipeline ........
|
--! Draining the pipeline ........
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
if smaster_write='0' then
|
if smaster_write='0' then
|
|
|
if sdrain_condition='1' then
|
if sdrain_condition='1' then
|
--! Flow Control : Hay muchos datos aun en la cola de resultados Ó la cola de resultados está casí vacía y no hay datos transitando en el pipeline aritm&eetico.
|
--! Flow Control : Hay muchos datos aun en la cola de resultados Ó la cola de resultados está casí vacía y no hay datos transitando en el pipeline aritm&eetico.
|
smaster_write <= '1';
|
smaster_write <= '1';
|
master_address <= sreg_block(reg_sinkstart);
|
master_address <= sreg_block(reg_sinkstart);
|
master_burstcount <= sdrain_burstcount;
|
master_burstcount <= sdrain_burstcount;
|
|
|
--!Context Saving
|
--!Context Saving
|
sreg_block(reg_sinkstart) <= sreg_block(reg_sinkstart) + (sdrain_burstcount&"00");
|
sreg_block(reg_sinkstart) <= sreg_block(reg_sinkstart) + (sdrain_burstcount&"00");
|
sburstcount_sink <= sdrain_burstcount-1;
|
sburstcount_sink <= sdrain_burstcount-1;
|
else
|
else
|
--! Flow Control: Son muy pocos los datos que hay en el buffer de salida y existen aun datos transitando en el resto del pipe ir al estado SOURCE.
|
--! Flow Control: Son muy pocos los datos que hay en el buffer de salida y existen aun datos transitando en el resto del pipe ir al estado SOURCE.
|
if sZeroTransit='1' then
|
if sZeroTransit='1' then
|
|
|
--! Flow Control: Finalizada la instrucción, generar una interrupción e ir al estado IDLE.
|
--! Flow Control: Finalizada la instrucción, generar una interrupción e ir al estado IDLE.
|
sm <= IDLE;
|
sm <= IDLE;
|
sreg_block(reg_ctrl)(reg_ctrl_irq) <= '1';
|
sreg_block(reg_ctrl)(reg_ctrl_irq) <= '1';
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '0';
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '0';
|
sreg_block(reg_ctrl)(reg_ctrl_flags_dc downto reg_ctrl_flags_fc) <= sdrain_condition & sflood_condition;
|
sreg_block(reg_ctrl)(reg_ctrl_flags_dc downto reg_ctrl_flags_fc) <= sdrain_condition & sflood_condition;
|
sreg_block(reg_ctrl)(reg_ctrl_flags_ap downto reg_ctrl_flags_wp) <= sload_add_pending & sfetch_data_pending & sparamload_pending & spipeline_pending & swrite_pending;
|
sreg_block(reg_ctrl)(reg_ctrl_flags_ap downto reg_ctrl_flags_wp) <= sload_add_pending & sfetch_data_pending & sparamload_pending & spipeline_pending & swrite_pending;
|
|
|
else
|
else
|
|
|
--! Flow Control: Cambiar a Source porque aun hay elementos transitando.
|
--! Flow Control: Cambiar a Source porque aun hay elementos transitando.
|
sm <= SOURCE;
|
sm <= SOURCE;
|
end if;
|
end if;
|
|
|
end if;
|
end if;
|
else --!smaster_write=1
|
else --!smaster_write=1
|
if master_waitrequest = '0' then
|
if master_waitrequest = '0' then
|
|
|
--! Descartar datos : revisar antes de este proceso secuencial la parte combinatoria (Data Dumpster).
|
--! Descartar datos : revisar antes de este proceso secuencial la parte combinatoria (Data Dumpster).
|
|
|
|
|
if sburstcount_sink/=zero(mb downto 0) then
|
if sburstcount_sink/=zero(mb downto 0) then
|
|
|
--! Datos pendientes por transmitir aun en el burst. Restar uno
|
--! Datos pendientes por transmitir aun en el burst. Restar uno
|
sburstcount_sink <= sburstcount_sink-1;
|
sburstcount_sink <= sburstcount_sink-1;
|
else
|
else
|
|
|
--! No escribir mas. Finalizar la transmisión
|
--! No escribir mas. Finalizar la transmisión
|
smaster_write <= '0';
|
smaster_write <= '0';
|
|
|
--! Si no hay transito de dato se con terminada la instrucción siempre que el estado de control de flujo esté sidera
|
--! Si no hay transito de dato se con terminada la instrucción siempre que el estado de control de flujo esté sidera
|
if sZeroTransit='1' then
|
if sZeroTransit='1' then
|
|
|
--! Flow Control: Finalizada la instrucción, generar una interrupción e ir al estado IDLE.
|
--! Flow Control: Finalizada la instrucción, generar una interrupción e ir al estado IDLE.
|
sm <= IDLE;
|
sm <= IDLE;
|
sreg_block(reg_ctrl)(reg_ctrl_irq) <= '1';
|
sreg_block(reg_ctrl)(reg_ctrl_irq) <= '1';
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '0';
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '0';
|
sreg_block(reg_ctrl)(reg_ctrl_flags_dc downto reg_ctrl_flags_fc) <= sdrain_condition & sflood_condition;
|
sreg_block(reg_ctrl)(reg_ctrl_flags_dc downto reg_ctrl_flags_fc) <= sdrain_condition & sflood_condition;
|
sreg_block(reg_ctrl)(reg_ctrl_flags_ap downto reg_ctrl_flags_wp) <= sload_add_pending & sfetch_data_pending & sparamload_pending & spipeline_pending & swrite_pending;
|
sreg_block(reg_ctrl)(reg_ctrl_flags_ap downto reg_ctrl_flags_wp) <= sload_add_pending & sfetch_data_pending & sparamload_pending & spipeline_pending & swrite_pending;
|
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
when IDLE =>
|
when IDLE =>
|
|
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! Programming the pipeline
|
--! Programming the pipeline
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! El registro de control en sus campos fetch e irq, es escribile solo cuando estamos en estado IDLE.
|
--! El registro de control en sus campos fetch e irq, es escribile solo cuando estamos en estado IDLE.
|
if sslave_write='1' then
|
if sslave_write='1' then
|
case sslave_address is
|
case sslave_address is
|
when x"0" =>
|
when x"0" =>
|
--! Solo se permitira escribir en el registro de control si no hay una interrupción activa o si la hay solamente si se esta intentando desactivar la interrupci´n
|
--! Solo se permitira escribir en el registro de control si no hay una interrupción activa o si la hay solamente si se esta intentando desactivar la interrupci´n
|
if sreg_block(reg_ctrl)(reg_ctrl_irq)='0' or sslave_writedata(reg_ctrl_irq)='0' then
|
if sreg_block(reg_ctrl)(reg_ctrl_irq)='0' or sslave_writedata(reg_ctrl_irq)='0' then
|
sreg_block(reg_ctrl)<= sslave_writedata;
|
sreg_block(reg_ctrl)<= sslave_writedata;
|
end if;
|
end if;
|
when x"5" => sreg_block(reg_nfetch) <= sslave_writedata;
|
when x"5" => sreg_block(reg_nfetch) <= sslave_writedata;
|
when x"6" => sreg_block(reg_outputcounter) <= sslave_writedata;
|
when x"6" => sreg_block(reg_outputcounter) <= sslave_writedata;
|
when x"7" => sreg_block(reg_inputcounter) <= sslave_writedata;
|
when x"7" => sreg_block(reg_inputcounter) <= sslave_writedata;
|
when x"8" => sreg_block(reg_fetchstart) <= sslave_writedata;
|
when x"8" => sreg_block(reg_fetchstart) <= sslave_writedata;
|
when x"9" => sreg_block(reg_sinkstart) <= sslave_writedata;
|
when x"9" => sreg_block(reg_sinkstart) <= sslave_writedata;
|
when others => null;
|
when others => null;
|
end case;
|
end case;
|
else
|
else
|
|
|
if sZeroTransit='0' then
|
if sZeroTransit='0' then
|
|
|
|
|
--! Flow Control: Existe un número de descargas programadas por el sistema, comenzar a realizarlas.
|
--! Flow Control: Existe un número de descargas programadas por el sistema, comenzar a realizarlas.
|
--! Ir al estado Source.
|
--! Ir al estado Source.
|
sm <= SOURCE;
|
sm <= SOURCE;
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '1';
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '1';
|
|
|
else
|
else
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '0';
|
sreg_block(reg_ctrl)(reg_ctrl_rom) <= '0';
|
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end case;
|
end case;
|
end if;
|
end if;
|
end process;
|
end process;
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! FLOW CONTROL RTL CODE
|
--! FLOW CONTROL RTL CODE
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! buffer de salida
|
--! buffer de salida
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
output_buffer:scfifo
|
output_buffer:scfifo
|
generic map (almost_empty_value => 2**mb,almost_full_value => (2**fd)-52, lpm_widthu => fd, lpm_numwords => 2**fd, lpm_showahead => "ON", lpm_width => 32, overflow_checking => "ON", underflow_checking => "ON", use_eab => "ON")
|
generic map (almost_empty_value => 2**mb,almost_full_value => (2**fd)-52, lpm_widthu => fd, lpm_numwords => 2**fd, lpm_showahead => "ON", lpm_width => 32, overflow_checking => "ON", underflow_checking => "ON", use_eab => "ON")
|
port map (empty => soutb_e, aclr => '0', clock => clk, rdreq => soutb_ack, wrreq => soutb_w, q => master_writedata, usedw => soutb_usedw, almost_full => soutb_af, almost_empty => soutb_ae, data => soutb_d);
|
port map (empty => soutb_e, aclr => '0', clock => clk, rdreq => soutb_ack, wrreq => soutb_w, q => master_writedata, usedw => soutb_usedw, almost_full => soutb_af, almost_empty => soutb_ae, data => soutb_d);
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! PROCESO DE CONTROL DE FLUJO ENTRE EL BUFFER DE RESULTADOS Y EL BUFFER DE SALIDA
|
--! PROCESO DE CONTROL DE FLUJO ENTRE EL BUFFER DE RESULTADOS Y EL BUFFER DE SALIDA
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
|
|
FLOW_CONTROL_OUTPUT_STAGE:
|
FLOW_CONTROL_OUTPUT_STAGE:
|
process (clk,rst,master_readdata, master_readdatavalid,sr_e,sreg_block(reg_ctrl)(reg_ctrl_vt downto reg_ctrl_sc),sm,supload_chain,zero,ssync_chain_pending,supload_start)
|
process (clk,rst,master_readdata, master_readdatavalid,sr_e,sreg_block(reg_ctrl)(reg_ctrl_vt downto reg_ctrl_sc),sm,supload_chain,zero,ssync_chain_pending,supload_start)
|
begin
|
begin
|
|
|
|
|
--! Compute initial State.
|
--! Compute initial State.
|
|
|
--! Escribir en el output buffer.
|
--! Escribir en el output buffer.
|
if supload_chain=DMA then
|
if supload_chain=DMA then
|
--! Modo DMA escribir los datos de entrada directamente en el buffer.
|
--! Modo DMA escribir los datos de entrada directamente en el buffer.
|
soutb_w <= master_readdatavalid;
|
soutb_w <= master_readdatavalid;
|
else
|
else
|
--!Modo Arithmetic Pipeline
|
--!Modo Arithmetic Pipeline
|
soutb_w <= not(sr_e);
|
soutb_w <= not(sr_e);
|
end if;
|
end if;
|
|
|
--! Control de lectura de la cola de resultados.
|
--! Control de lectura de la cola de resultados.
|
if sr_e='0' then
|
if sr_e='0' then
|
--!Hay datos en la cola de resultados.
|
--!Hay datos en la cola de resultados.
|
if (supload_chain=UPVZ and sreg_block(reg_ctrl)(reg_ctrl_sc)='0') or supload_chain=SC then
|
if (supload_chain=UPVZ and sreg_block(reg_ctrl)(reg_ctrl_sc)='0') or supload_chain=SC then
|
--!Se transfiere el ultimo componente vectorial y no se estan cargando resultados escalares.
|
--!Se transfiere el ultimo componente vectorial y no se estan cargando resultados escalares.
|
sr_ack <= '1';
|
sr_ack <= '1';
|
else
|
else
|
sr_ack <= '0';
|
sr_ack <= '0';
|
end if;
|
end if;
|
else
|
else
|
sr_ack <= '0';
|
sr_ack <= '0';
|
end if;
|
end if;
|
|
|
|
|
--! Decodificar que salida de la cola de resultados se conecta a la entrada del otput buffer
|
--! Decodificar que salida de la cola de resultados se conecta a la entrada del otput buffer
|
--! DMA Path Control: Si se encuentra habilitado el modo dma entonces conectar la entrada del buffer de salida a la interconexión
|
--! DMA Path Control: Si se encuentra habilitado el modo dma entonces conectar la entrada del buffer de salida a la interconexión
|
case supload_chain is
|
case supload_chain is
|
when UPVX =>
|
when UPVX =>
|
soutb_d <= svx;
|
soutb_d <= svx;
|
when UPVY =>
|
when UPVY =>
|
soutb_d <= svy;
|
soutb_d <= svy;
|
when UPVZ =>
|
when UPVZ =>
|
soutb_d <= svz;
|
soutb_d <= svz;
|
when SC =>
|
when SC =>
|
soutb_d <= ssc;
|
soutb_d <= ssc;
|
when DMA =>
|
when DMA =>
|
soutb_d <= master_readdata;
|
soutb_d <= master_readdata;
|
end case;
|
end case;
|
|
|
|
|
case sreg_block(reg_ctrl)(reg_ctrl_vt downto reg_ctrl_sc) is
|
case sreg_block(reg_ctrl)(reg_ctrl_vt downto reg_ctrl_sc) is
|
when "01" =>
|
when "01" =>
|
supload_start <= SC;
|
supload_start <= SC;
|
when others =>
|
when others =>
|
supload_start <= UPVX;
|
supload_start <= UPVX;
|
end case;
|
end case;
|
|
|
|
|
--! Máquina de estados para el width adaptation RES(128) -> OUTPUTBUFFER(32).
|
--! Máquina de estados para el width adaptation RES(128) -> OUTPUTBUFFER(32).
|
if rst=rstMasterValue then
|
if rst=rstMasterValue then
|
supload_chain <= UPVX;
|
supload_chain <= UPVX;
|
elsif clk'event and clk='1' and sreg_block(reg_ctrl)(reg_ctrl_dma)='0' then
|
elsif clk'event and clk='1' and sreg_block(reg_ctrl)(reg_ctrl_dma)='0' then
|
--! Modo de operación normal.
|
--! Modo de operación normal.
|
case supload_chain is
|
case supload_chain is
|
when UPVX =>
|
when UPVX =>
|
if sr_e='1' then
|
if sr_e='1' then
|
supload_chain <= supload_start;
|
supload_chain <= supload_start;
|
else
|
else
|
supload_chain <= UPVY;
|
supload_chain <= UPVY;
|
end if;
|
end if;
|
when UPVY =>
|
when UPVY =>
|
supload_chain <= UPVZ;
|
supload_chain <= UPVZ;
|
when UPVZ =>
|
when UPVZ =>
|
if sreg_block(reg_ctrl)(reg_ctrl_sc)='0' then
|
if sreg_block(reg_ctrl)(reg_ctrl_sc)='0' then
|
supload_chain <= UPVX;
|
supload_chain <= UPVX;
|
else
|
else
|
supload_chain <= SC;
|
supload_chain <= SC;
|
end if;
|
end if;
|
when SC|DMA =>
|
when SC|DMA =>
|
supload_chain <= supload_start;
|
supload_chain <= supload_start;
|
|
|
end case;
|
end case;
|
|
|
elsif clk'event and clk='1' then
|
elsif clk'event and clk='1' then
|
--! Modo DMA
|
--! Modo DMA
|
supload_chain <= DMA;
|
supload_chain <= DMA;
|
end if;
|
end if;
|
|
|
|
|
end process;
|
end process;
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
--! PROCESO DE CONTROL DE FLUJO ENTRE LA ENTRADA DESDE LA INTERCONEXI&OACUTE;N Y LOS PARAMETROS DE ENTRADA EN EL PIPELINE ARITMETICO
|
--! PROCESO DE CONTROL DE FLUJO ENTRE LA ENTRADA DESDE LA INTERCONEXI&OACUTE;N Y LOS PARAMETROS DE ENTRADA EN EL PIPELINE ARITMETICO
|
--! ******************************************************************************************************************************************************
|
--! ******************************************************************************************************************************************************
|
FLOW_CONTROL_INPUT_STAGE:
|
FLOW_CONTROL_INPUT_STAGE:
|
process(clk,rst,master_readdatavalid,master_readdata,sreg_block(reg_ctrl)(reg_ctrl_dma downto reg_ctrl_s),sslave_write,sslave_address,supload_chain)
|
process(clk,rst,master_readdatavalid,master_readdata,sreg_block(reg_ctrl)(reg_ctrl_dma downto reg_ctrl_s),sslave_write,sslave_address,supload_chain)
|
begin
|
begin
|
--! Está ocurriendo un evento de transición del estado TX al estado FETCH: Programar el enganche de parámetros que vienen de la interconexión.
|
--! Está ocurriendo un evento de transición del estado TX al estado FETCH: Programar el enganche de parámetros que vienen de la interconexión.
|
--! Mirar como es la carga inicial. Si es Normalizacion o Magnitud (dcs=110) entonces cargar DWAXBX de lo contrario solo DWAX.
|
--! Mirar como es la carga inicial. Si es Normalizacion o Magnitud (dcs=110) entonces cargar DWAXBX de lo contrario solo DWAX.
|
case sreg_block(reg_ctrl)(reg_ctrl_d downto reg_ctrl_s) is
|
case sreg_block(reg_ctrl)(reg_ctrl_d downto reg_ctrl_s) is
|
when "110" => sdownload_start <= DWAXBX;
|
when "110" => sdownload_start <= DWAXBX;
|
when others => sdownload_start <= DWAX;
|
when others => sdownload_start <= DWAX;
|
end case;
|
end case;
|
if rst=rstMasterValue then
|
if rst=rstMasterValue then
|
ssync_chain_1 <= '0';
|
ssync_chain_1 <= '0';
|
sdownload_chain <= DWAX;
|
sdownload_chain <= DWAX;
|
for i in reg_bz downto reg_ax loop
|
for i in reg_bz downto reg_ax loop
|
sreg_block(i) <= (others => '0');
|
sreg_block(i) <= (others => '0');
|
end loop;
|
end loop;
|
elsif clk'event and clk='1' then
|
elsif clk'event and clk='1' then
|
ssync_chain_1 <= '0';
|
ssync_chain_1 <= '0';
|
if master_readdatavalid='1' and sreg_block(reg_ctrl)(reg_ctrl_dma)='0' then
|
if master_readdatavalid='1' and sreg_block(reg_ctrl)(reg_ctrl_dma)='0' then
|
--! El dato en la interconexión es valido, se debe enganchar.
|
--! El dato en la interconexión es valido, se debe enganchar.
|
case sdownload_chain is
|
case sdownload_chain is
|
when DWAX | DWAXBX =>
|
when DWAX | DWAXBX =>
|
--! Cargar el operando correspondiente al componente "X" del vector "A"
|
--! Cargar el operando correspondiente al componente "X" del vector "A"
|
ssync_chain_1 <= '0';
|
ssync_chain_1 <= '0';
|
sreg_block(reg_ax) <= master_readdata;
|
sreg_block(reg_ax) <= master_readdata;
|
if sdownload_start = DWAXBX then
|
if sdownload_start = DWAXBX then
|
--! Operación Unaria por ejemplo magnitud de un vector
|
--! Operación Unaria por ejemplo magnitud de un vector
|
--! Escribir en el registro bx adicionalmente.
|
--! Escribir en el registro bx adicionalmente.
|
sreg_block(reg_bx) <= master_readdata;
|
sreg_block(reg_bx) <= master_readdata;
|
--! El siguiente estado es cargar el componente "Y" de del operando a ejecutar.
|
--! El siguiente estado es cargar el componente "Y" de del operando a ejecutar.
|
sdownload_chain <= DWAYBY;
|
sdownload_chain <= DWAYBY;
|
else
|
else
|
--! Operación de dos operandos. Por ejemplo Producto Cruz.
|
--! Operación de dos operandos. Por ejemplo Producto Cruz.
|
--! El siguiente estado es cargar el vector "Y" del operando "A".
|
--! El siguiente estado es cargar el vector "Y" del operando "A".
|
sdownload_chain <= DWAY;
|
sdownload_chain <= DWAY;
|
end if;
|
end if;
|
when DWAY | DWAYBY =>
|
when DWAY | DWAYBY =>
|
sreg_block(reg_ay) <= master_readdata;
|
sreg_block(reg_ay) <= master_readdata;
|
ssync_chain_1 <= '0';
|
ssync_chain_1 <= '0';
|
if sdownload_chain = DWAYBY then
|
if sdownload_chain = DWAYBY then
|
sreg_block(reg_by) <= master_readdata;
|
sreg_block(reg_by) <= master_readdata;
|
sdownload_chain <= DWAZBZ;
|
sdownload_chain <= DWAZBZ;
|
else
|
else
|
sdownload_chain <= DWAZ;
|
sdownload_chain <= DWAZ;
|
end if;
|
end if;
|
when DWAZ | DWAZBZ =>
|
when DWAZ | DWAZBZ =>
|
sreg_block(reg_az) <= master_readdata;
|
sreg_block(reg_az) <= master_readdata;
|
if sdownload_chain=DWAZBZ then
|
if sdownload_chain=DWAZBZ then
|
ssync_chain_1 <= '1';
|
ssync_chain_1 <= '1';
|
sreg_block(reg_bz) <= master_readdata;
|
sreg_block(reg_bz) <= master_readdata;
|
sdownload_chain <= DWAXBX;
|
sdownload_chain <= DWAXBX;
|
else
|
else
|
ssync_chain_1 <= '0';
|
ssync_chain_1 <= '0';
|
sdownload_chain <= DWBX;
|
sdownload_chain <= DWBX;
|
end if;
|
end if;
|
when DWBX =>
|
when DWBX =>
|
ssync_chain_1 <= '0';
|
ssync_chain_1 <= '0';
|
sreg_block(reg_bx) <= master_readdata;
|
sreg_block(reg_bx) <= master_readdata;
|
sdownload_chain <= DWBY;
|
sdownload_chain <= DWBY;
|
when DWBY =>
|
when DWBY =>
|
ssync_chain_1 <= '0';
|
ssync_chain_1 <= '0';
|
sreg_block(reg_by) <= master_readdata;
|
sreg_block(reg_by) <= master_readdata;
|
sdownload_chain <= DWBZ;
|
sdownload_chain <= DWBZ;
|
when DWBZ =>
|
when DWBZ =>
|
sreg_block(reg_bz) <= master_readdata;
|
sreg_block(reg_bz) <= master_readdata;
|
ssync_chain_1 <= '1';
|
ssync_chain_1 <= '1';
|
if sreg_block(reg_ctrl)(reg_ctrl_cmb)='1' then
|
if sreg_block(reg_ctrl)(reg_ctrl_cmb)='1' then
|
sdownload_chain <= DWBX;
|
sdownload_chain <= DWBX;
|
else
|
else
|
sdownload_chain <= DWAX;
|
sdownload_chain <= DWAX;
|
end if;
|
end if;
|
when others =>
|
when others =>
|
null;
|
null;
|
end case;
|
end case;
|
|
|
if srestart_chain='1' then
|
if srestart_chain='1' then
|
sdownload_chain <= sdownload_start;
|
sdownload_chain <= sdownload_start;
|
end if;
|
end if;
|
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! AVALON MEMORY MAPPED MASTER FINISHED
|
--! AVALON MEMORY MAPPED MASTER FINISHED
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! AVALON MEMORY MAPPED SLAVE BEGINS => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => =>
|
--! AVALON MEMORY MAPPED SLAVE BEGINS => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => => =>
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! Master Slave Process: Proceso para la escritura y lectura de registros desde el NIOS II.
|
--! Master Slave Process: Proceso para la escritura y lectura de registros desde el NIOS II.
|
low_register_bank:
|
low_register_bank:
|
process (clk,rst,sreg_block,soutb_w,supload_chain)
|
process (clk,rst,sreg_block,soutb_w,supload_chain)
|
begin
|
begin
|
if rst=rstMasterValue then
|
if rst=rstMasterValue then
|
for i in reg_scalar downto reg_vz loop
|
for i in reg_scalar downto reg_vz loop
|
sreg_block(i) <= (others => '0');
|
sreg_block(i) <= (others => '0');
|
end loop;
|
end loop;
|
|
|
slave_readdata <= (others => '0');
|
slave_readdata <= (others => '0');
|
sslave_address <= (others => '0');
|
sslave_address <= (others => '0');
|
sslave_writedata <= (others => '0');
|
sslave_writedata <= (others => '0');
|
sslave_write <= '0';
|
sslave_write <= '0';
|
sslave_read <= '0';
|
sslave_read <= '0';
|
elsif clk'event and clk='1' then
|
elsif clk'event and clk='1' then
|
|
|
|
|
sslave_address <= slave_address;
|
sslave_address <= slave_address;
|
sslave_write <= slave_write;
|
sslave_write <= slave_write;
|
sslave_read <= slave_read;
|
sslave_read <= slave_read;
|
sslave_writedata <= slave_writedata;
|
sslave_writedata <= slave_writedata;
|
|
|
|
sreg_block(reg_vz) <= sp0;
|
for i in reg_scalar downto reg_vz loop
|
sreg_block(reg_vy) <= sp1;
|
|
sreg_block(reg_vx) <= sp2;
|
|
for i in reg_scalar downto reg_scalar loop
|
if sslave_address=i then
|
if sslave_address=i then
|
if sslave_write='1' then
|
if sslave_write='1' then
|
sreg_block(i) <= sslave_writedata;
|
sreg_block(i) <= sslave_writedata;
|
end if;
|
end if;
|
end if;
|
end if;
|
end loop;
|
end loop;
|
for i in 15 downto 0 loop
|
for i in 15 downto 0 loop
|
if sslave_address=i then
|
if sslave_address=i then
|
if sslave_read='1' then
|
if sslave_read='1' then
|
slave_readdata <= sreg_block(i);
|
slave_readdata <= sreg_block(i);
|
end if;
|
end if;
|
end if;
|
end if;
|
end loop;
|
end loop;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! AVALON MEMORY MAPPED SLAVE FINISHED
|
--! AVALON MEMORY MAPPED SLAVE FINISHED
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--! *************************************************************************************************************************************************************************************************************************************************************
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--! Control Register (reg_ctrl) BASE_ADDRESS + 0x0 |
|
--! Control Register (reg_ctrl) BASE_ADDRESS + 0x0 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--! Bit No. | Nombre | Descripción |
|
--! Bit No. | Nombre | Descripción |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--! 0 | cmb (rw) | 1: La operación es combinatoria, por lo tanto cargan los primeros 3 valores en el Operando A y el |
|
--! 0 | cmb (rw) | 1: La operación es combinatoria, por lo tanto cargan los primeros 3 valores en el Operando A y el |
|
--! | | de vectores en el operando B. |
|
--! | | de vectores en el operando B. |
|
--! | | 0: La operación no es combinatoria, se cargan vectores en los operandos A y B. |
|
--! | | 0: La operación no es combinatoria, se cargan vectores en los operandos A y B. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! | | Configuración del Datapath, Interconexión del Pipeline Aritmético y Cadena de Carga |
|
--! | | Configuración del Datapath, Interconexión del Pipeline Aritmético y Cadena de Carga |
|
--! | | Dependiendo del valor de estos 3 bits se configura la operación a ejecutar. |
|
--! | | Dependiendo del valor de estos 3 bits se configura la operación a ejecutar. |
|
--! | | |
|
--! | | |
|
--! [3:1] | dcs (rw) | 011: Producto Cruz |
|
--! [3:1] | dcs (rw) | 011: Producto Cruz |
|
--! | | 000: Suma Vectorial |
|
--! | | 000: Suma Vectorial |
|
--! | | 001: Resta Vectorial |
|
--! | | 001: Resta Vectorial |
|
--! | | 110: Normalización Vectorial y cálculo de Magnitud Vectorial |
|
--! | | 110: Normalización Vectorial y cálculo de Magnitud Vectorial |
|
--! | | 100: Producto Punto |
|
--! | | 100: Producto Punto |
|
--! | | 111: Producto Simple |
|
--! | | 111: Producto Simple |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! [5:4] | vtsc (rw) | 00: Solo leer los resultados vectoriales. |
|
--! [5:4] | vtsc (rw) | 00: Solo leer los resultados vectoriales. |
|
--! | | 01: Solo leer los resultados escalares. |
|
--! | | 01: Solo leer los resultados escalares. |
|
--! | | 10: Solo leer los resultados vectoriales. |
|
--! | | 10: Solo leer los resultados vectoriales. |
|
--! | | 11: Leer los resultados escalares y vectoriales. |
|
--! | | 11: Leer los resultados escalares y vectoriales. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 6 | dma (rw) | 1: Modo DMA: Los datos que ingresan se leen desde la dirección FETCHSTART (BASE+0x08) y se escriben en |
|
--! 6 | dma (rw) | 1: Modo DMA: Los datos que ingresan se leen desde la dirección FETCHSTART (BASE+0x08) y se escriben en |
|
--! | | la dirección SINKSTART (BASE+0x09). |
|
--! | | la dirección SINKSTART (BASE+0x09). |
|
--! | | 0: Modo Arithmetic Pipeline: Los datos ingresan en grupos de a 6 valores para 2 vectores de 3 valores cada uno,|
|
--! | | 0: Modo Arithmetic Pipeline: Los datos ingresan en grupos de a 6 valores para 2 vectores de 3 valores cada uno,|
|
--! | | cuando se usa en modo uno a uno (cmb=1), ó en grupos de 3 valores para 1 vector de 3 valores, |
|
--! | | cuando se usa en modo uno a uno (cmb=1), ó en grupos de 3 valores para 1 vector de 3 valores, |
|
--! | | pero con el operando A fijado con el valor de la primera carga de valores en modo combinatorio (cmb=1). |
|
--! | | pero con el operando A fijado con el valor de la primera carga de valores en modo combinatorio (cmb=1). |
|
--! | | De la misma manera que en modo DMA se cargan los operandos en la dirección FETCHSTART y se escriben |
|
--! | | De la misma manera que en modo DMA se cargan los operandos en la dirección FETCHSTART y se escriben |
|
--! | | los resultados en la dirección SINKSTART. |
|
--! | | los resultados en la dirección SINKSTART. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 7 | flag_fc(r)| 1: Al momento de generar una interrupción este bit se coloca en 1 si se cumplen las condiciones de |
|
--! 7 | flag_fc(r)| 1: Al momento de generar una interrupción este bit se coloca en 1 si se cumplen las condiciones de |
|
--! | | descarga de datos de la memoria (revisar el net signal sflood_condition). Si se encuentra en uno se |
|
--! | | descarga de datos de la memoria (revisar el net signal sflood_condition). Si se encuentra en uno se |
|
--! | | trataría de una inconsistencia puesto que la interrupción se dispara una vez se ha terminado |
|
--! | | trataría de una inconsistencia puesto que la interrupción se dispara una vez se ha terminado |
|
--! | | de ejecutar una instrucción y el que la bandera este en uno significa que hay transacciones de |
|
--! | | de ejecutar una instrucción y el que la bandera este en uno significa que hay transacciones de |
|
--! | | descarga de datos desde la memoria pendientes. |
|
--! | | descarga de datos desde la memoria pendientes. |
|
--! | | |
|
--! | | |
|
--! | | En general que cualquiera de estas banderas se coloque en uno es una señalizacion de error, puesto |
|
--! | | En general que cualquiera de estas banderas se coloque en uno es una señalizacion de error, puesto |
|
--! | | que una vez se ha terminado de ejecutar una instrucción no deben haber transacciones pendientes. |
|
--! | | que una vez se ha terminado de ejecutar una instrucción no deben haber transacciones pendientes. |
|
--! | | La razón de ser de estas banderas es hacer depuración del hardware mas que del software. |
|
--! | | La razón de ser de estas banderas es hacer depuración del hardware mas que del software. |
|
--! | | |
|
--! | | |
|
--! | | 0: Flood Condition off. |
|
--! | | 0: Flood Condition off. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 8 | flag_dc(r)| 1: Error, la instrucción ya se ejecutó y hay datos transitando en el buffer de salida aun. |
|
--! 8 | flag_dc(r)| 1: Error, la instrucción ya se ejecutó y hay datos transitando en el buffer de salida aun. |
|
--! | | 0: Drain Condition off. |
|
--! | | 0: Drain Condition off. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 9 | wp(r) | 1: Error, la instrucción ya se ejecutó y hay datos transitando en el buffer de salida aun. |
|
--! 9 | wp(r) | 1: Error, la instrucción ya se ejecutó y hay datos transitando en el buffer de salida aun. |
|
--! | | 0: Write on Memory not pending. |
|
--! | | 0: Write on Memory not pending. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 10 | pp(r) | 1: Error, la instrucción ya se ejecutón y hay datos transitando el pipeline aritmético. |
|
--! 10 | pp(r) | 1: Error, la instrucción ya se ejecutón y hay datos transitando el pipeline aritmético. |
|
--! | | 0: Pipeline not pending. |
|
--! | | 0: Pipeline not pending. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 11 | pl(r) | 1: La carga de parametros no se completó. Esto por lo general pasa cuando uno va a realizar una |
|
--! 11 | pl(r) | 1: La carga de parametros no se completó. Esto por lo general pasa cuando uno va a realizar una |
|
--! | | operaci´n combinatoria y solo cargo el primer operando, el A, esto puede ocurrir porque por ejemplo |
|
--! | | operaci´n combinatoria y solo cargo el primer operando, el A, esto puede ocurrir porque por ejemplo |
|
--! | | se puede desear sumar un conjunto de vectores a un vector de referencia. Este vector de referencia puede |
|
--! | | se puede desear sumar un conjunto de vectores a un vector de referencia. Este vector de referencia puede |
|
--! | | estar en un area de memoria distinta, que el resto de los vectores. Por lo tanto el pseudo codigo para |
|
--! | | estar en un area de memoria distinta, que el resto de los vectores. Por lo tanto el pseudo codigo para |
|
--! | | ejecutar una operación de este tipo seria: |
|
--! | | ejecutar una operación de este tipo seria: |
|
--! | | |
|
--! | | |
|
--! | | ld vect,add,cmb; //Resultados solo vectoriales, ejecutar operación suma en modo combinatorio |
|
--! | | ld vect,add,cmb; //Resultados solo vectoriales, ejecutar operación suma en modo combinatorio |
|
--! | | ld &A; //Cargar la direccion del Vector A. |
|
--! | | ld &A; //Cargar la direccion del Vector A. |
|
--! | | ld 3; //Cargar 3 valores, o sea el Vector A. |
|
--! | | ld 3; //Cargar 3 valores, o sea el Vector A. |
|
--! | | wait int; //Esperar a que se ejecute la interrupcion. Una vez se termine de ejecutar si la bandera|
|
--! | | wait int; //Esperar a que se ejecute la interrupcion. Una vez se termine de ejecutar si la bandera|
|
--! | | //pl está en uno se vuelve a comenzar y se deshecha el dato que hay como |
|
--! | | //pl está en uno se vuelve a comenzar y se deshecha el dato que hay como |
|
--! | | //parámetro. Para este ejemplo se asume que está en uno |
|
--! | | //parámetro. Para este ejemplo se asume que está en uno |
|
--! | | ld &B; //Cargar la dirección donde se encuentran los vectores B |
|
--! | | ld &B; //Cargar la dirección donde se encuentran los vectores B |
|
--! | | ld &C; //Cargar la dirección donde se exribiran los resultados. |
|
--! | | ld &C; //Cargar la dirección donde se exribiran los resultados. |
|
--! | | ld 24; //Cargar los siguientes 24 valores a partir de &B correspondiente a 8 vectores |
|
--! | | ld 24; //Cargar los siguientes 24 valores a partir de &B correspondiente a 8 vectores |
|
--! | | //ejecutando 8 sumas vectoriales que se escribirín a apartir de &C |
|
--! | | //ejecutando 8 sumas vectoriales que se escribirín a apartir de &C |
|
--! | | wait int; //Esperar a que termine la ejecución de las sumas. |
|
--! | | wait int; //Esperar a que termine la ejecución de las sumas. |
|
--! | | |
|
--! | | |
|
--! | | 0: Los operandos se cargaron integros se cargo del todo y no hubo que desechar parametros. |
|
--! | | 0: Los operandos se cargaron integros se cargo del todo y no hubo que desechar parametros. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 12 | dp (r) | 1: Error, la instrucción se termino y aun hay datos pendientes por ser descargados |
|
--! 12 | dp (r) | 1: Error, la instrucción se termino y aun hay datos pendientes por ser descargados |
|
--! | | 0: No hay datos pendientes por ser descargados. |
|
--! | | 0: No hay datos pendientes por ser descargados. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 13 | ap (r) | 1: Carga de direcciones en la interconexión aún está pendiente y la instrucció ya |
|
--! 13 | ap (r) | 1: Carga de direcciones en la interconexión aún está pendiente y la instrucció ya |
|
--! | | se ejecutó |
|
--! | | se ejecutó |
|
--! | | 0: No hay direcciones pendientes por cargar. |
|
--! | | 0: No hay direcciones pendientes por cargar. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 14 | rlsc (rw) | 1: El sistema está configurado para resetear la recarga sincronizada de parámetros una vez |
|
--! 14 | rlsc (rw) | 1: El sistema está configurado para resetear la recarga sincronizada de parámetros una vez |
|
--! | | concluya la instrucción |
|
--! | | concluya la instrucción |
|
--! | | |
|
--! | | |
|
--! | | 0: El sistema está configurado para no resetear la cadena de sincronización de carga. |
|
--! | | 0: El sistema está configurado para no resetear la cadena de sincronización de carga. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 15 | rom (r) | 1: Los registros solo se pueden leer no se pueden escribir. Etsado SINK y SOURCE |
|
--! 15 | rom (r) | 1: Los registros solo se pueden leer no se pueden escribir. Etsado SINK y SOURCE |
|
--! | | 0: Los registros se pueden leer y escribir. |
|
--! | | 0: Los registros se pueden leer y escribir. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! [30:16] | nfetch(rw)| Cantidad de direcciones a cargar en la interconexón para realizar la posterior descarga de datos de la |
|
--! [30:16] | nfetch(rw)| Cantidad de direcciones a cargar en la interconexón para realizar la posterior descarga de datos de la |
|
--! | | memoria al RayTrac.
|
--! | | memoria al RayTrac.
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! 31 | irq | 1: Evento de interrupción. El usuario debe hacer clear de este bit para dar la interrupci&o;n por |
|
--! 31 | irq | 1: Evento de interrupción. El usuario debe hacer clear de este bit para dar la interrupci&o;n por |
|
--! | | por atendida. Este bit se pone en uno cuando el sistema pasa de estado TX a FETCH o FETCH a TX. |
|
--! | | por atendida. Este bit se pone en uno cuando el sistema pasa de estado TX a FETCH o FETCH a TX. |
|
--! | | |
|
--! | | |
|
--! | | 0: El RayTrac se encuentra en operación Normal. |
|
--! | | 0: El RayTrac se encuentra en operación Normal. |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------
|
--! Result Vector Z component (reg_vz) BASE_ADDRESS + 0x4 |
|
--! Result Vector Z component (reg_vz) BASE_ADDRESS + 0x4 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Result Vector Y component (reg_vy) BASE_ADDRESS + 0x8 |
|
--! Result Vector Y component (reg_vy) BASE_ADDRESS + 0x8 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Result Vector X component (reg_vx) BASE_ADDRESS + 0xC |
|
--! Result Vector X component (reg_vx) BASE_ADDRESS + 0xC |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Result Vector Scalar component (reg_scalar) BASE_ADDRESS + 0x10 |
|
--! Result Vector Scalar component (reg_scalar) BASE_ADDRESS + 0x10 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Scratch Vector 00 (reg_nfetch) BASE_ADDRESS + 0x14 |
|
--! Scratch Vector 00 (reg_nfetch) BASE_ADDRESS + 0x14 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! output Data Counter (reg_outputcounter) BASE_ADDRESS + 0x18 |
|
--! output Data Counter (reg_outputcounter) BASE_ADDRESS + 0x18 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Input Data Counter (reg_inputcounter) BASE_ADDRESS + 0x1C |
|
--! Input Data Counter (reg_inputcounter) BASE_ADDRESS + 0x1C |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Data Fetch Start Address (reg_fetchstart) BASE_ADDRESS + 0x20 |
|
--! Data Fetch Start Address (reg_fetchstart) BASE_ADDRESS + 0x20 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Data Write Start Address (reg_sinkstart) BASE_ADDRESS + 0x24 |
|
--! Data Write Start Address (reg_sinkstart) BASE_ADDRESS + 0x24 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Parameter AX component (reg_ax) BASE_ADDRESS + 0x28 |
|
--! Parameter AX component (reg_ax) BASE_ADDRESS + 0x28 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Parameter Ay component (reg_ay) BASE_ADDRESS + 0x2C |
|
--! Parameter Ay component (reg_ay) BASE_ADDRESS + 0x2C |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Parameter Az component (reg_az) BASE_ADDRESS + 0x30 |
|
--! Parameter Az component (reg_az) BASE_ADDRESS + 0x30 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Parameter Bx component (reg_bx) BASE_ADDRESS + 0x34 |
|
--! Parameter Bx component (reg_bx) BASE_ADDRESS + 0x34 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Parameter By component (reg_by) BASE_ADDRESS + 0x38 |
|
--! Parameter By component (reg_by) BASE_ADDRESS + 0x38 |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--! Parameter Bz component (reg_bz) BASE_ADDRESS + 0x3C |
|
--! Parameter Bz component (reg_bz) BASE_ADDRESS + 0x3C |
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
--!---------|-----------|-------------------------------------------------------------------------------------------------------------------|
|
|
|
|
|
|
|
|
|
|
|
|
|
end architecture;
|
end architecture;
|
|
|
|
|