Line 25... |
Line 25... |
use work.arithpack.all;
|
use work.arithpack.all;
|
|
|
entity memblock is
|
entity memblock is
|
generic (
|
generic (
|
|
|
width : integer := 32;
|
|
blocksize : integer := 512;
|
blocksize : integer := 512;
|
widthadmemblock : integer :=9;
|
|
external_writeable_blocks : integer := 12;
|
external_writeable_blocks : integer := 12;
|
external_readable_blocks : integer := 8;
|
external_readable_blocks : integer := 8;
|
external_readable_widthad : integer := 3;
|
external_readable_widthad : integer := 3;
|
external_writeable_widthad : integer := 4
|
external_writeable_widthad : integer := 4
|
);
|
);
|
Line 42... |
Line 41... |
resultfifo_wr: in std_logic_vector(external_readable_blocks-1 downto 0);
|
resultfifo_wr: in std_logic_vector(external_readable_blocks-1 downto 0);
|
instrfifo_empty: out std_logic;
|
instrfifo_empty: out std_logic;
|
ext_rd,ext_wr: in std_logic;
|
ext_rd,ext_wr: in std_logic;
|
ext_wr_add : in std_logic_vector(external_writeable_widthad+widthadmemblock-1 downto 0);
|
ext_wr_add : in std_logic_vector(external_writeable_widthad+widthadmemblock-1 downto 0);
|
ext_rd_add : in std_logic_vector(external_readable_widthad-1 downto 0);
|
ext_rd_add : in std_logic_vector(external_readable_widthad-1 downto 0);
|
ext_d: in std_logic_vector(width-1 downto 0);
|
ext_d: in std_logic_vector(floatwidth-1 downto 0);
|
resultfifo_full : out std_logic_vector(3 downto 0);
|
resultfifo_full : out std_logic_vector(3 downto 0);
|
int_d : in std_logic_vector(external_readable_blocks*width-1 downto 0);
|
int_d : in std_logic_vector(external_readable_blocks*floatwidth-1 downto 0);
|
ext_q,instrfifo_q : out std_logic_vector(width-1 downto 0);
|
|
int_q : out std_logic_vector(external_writeable_blocks*width-1 downto 0);
|
--!Python
|
|
ext_q,instr fifo_q : out std_logic_vector(floatwidth-1 downto 0);
|
|
int_q : out std_logic_vector(external_writeable_blocks*floatwidth-1 downto 0);
|
int_rd_add : in std_logic_vector(2*widthadmemblock-1 downto 0);
|
int_rd_add : in std_logic_vector(2*widthadmemblock-1 downto 0);
|
dpfifo_d : in std_logic_vector(width*2-1 downto 0);
|
dpfifo_d : in std_logic_vector(floatwidth*2-1 downto 0);
|
normfifo_d : in std_logic_vector(width*3-1 downto 0);
|
normfifo_d : in std_logic_vector(floatwidth*3-1 downto 0);
|
dpfifo_q : out std_logic_vector(width*2-1 downto 0);
|
dpfifo_q : out std_logic_vector(floatwidth*2-1 downto 0);
|
normfifo_q : out std_logic_vector(width*3-1 downto 0)
|
normfifo_q : out std_logic_vector(floatwidth*3-1 downto 0)
|
);
|
);
|
end memblock;
|
end memblock;
|
|
|
architecture memblock_arch of memblock is
|
architecture memblock_arch of memblock is
|
|
|
type vectorblock12 is array (11 downto 0) of std_logic_vector(width-1 downto 0);
|
|
type vectorblock08 is array (07 downto 0) of std_logic_vector(width-1 downto 0);
|
|
type vectorblock02 is array (01 downto 0) of std_logic_vector(widthadmemblock-1 downto 0);
|
|
|
|
|
|
|
|
|
|
|
--!TBXSTART:MEMBLOCK_EXTERNAL_WRITE
|
signal s0ext_wr_add_one_hot : std_logic_vector(external_writeable_blocks-1+1 downto 0); --! La se ñal extra es para la escritura de la cola de instrucciones.
|
signal s0ext_wr_add_one_hot : std_logic_vector(external_writeable_blocks-1+1 downto 0); --! La se ñal extra es para la escritura de la cola de instrucciones.
|
signal s0ext_wr_add : std_logic_vector(external_writeable_widthad+widthadmemblock-1 downto 0);
|
signal s0ext_wr_add : std_logic_vector(external_writeable_widthad+widthadmemblock-1 downto 0);
|
|
signal s0ext_wr : std_logic;
|
|
signal s0ext_d : std_logic_vector(floatwidth-1 downto 0);
|
|
--!TBXEND
|
|
|
|
--!TBXSTART:MEMBLOCK_EXTERNAL_READ
|
signal s0ext_rd_add : std_logic_vector(external_readable_widthad-1 downto 0);
|
signal s0ext_rd_add : std_logic_vector(external_readable_widthad-1 downto 0);
|
signal s0int_rd_add : std_logic_vector(widthadmemblock-1 downto 0);
|
signal s0ext_rd : std_logic;
|
signal s0ext_wr,s0ext_rd : std_logic;
|
|
signal s0ext_d : std_logic_vector(width-1 downto 0);
|
|
signal s0ext_rd_ack : std_logic_vector(external_readable_blocks-1 downto 0);
|
signal s0ext_rd_ack : std_logic_vector(external_readable_blocks-1 downto 0);
|
signal s0ext_q,sint_d : vectorblock08;
|
signal s0ext_q : vectorblock08;
|
signal sint_rd_add : vectorblock02;
|
--!TBXEND
|
|
|
|
--!TBXSTART:MEMBLOCK_INTERNAL_READ
|
|
signal s0int_rd_add : std_logic_vector(widthadmemblock-1 downto 0);
|
|
signal sint_rd_add : vectorblockadd02;
|
signal s1int_q : vectorblock12;
|
signal s1int_q : vectorblock12;
|
|
--!TBXEND
|
|
|
|
--!TBXSTART:MEMBLOCK_INTERNAL_WRITE
|
|
signal sint_d : vectorblock08;
|
signal sresultfifo_full : std_logic_vector(7 downto 0);
|
signal sresultfifo_full : std_logic_vector(7 downto 0);
|
|
--!TBXEND
|
|
|
begin
|
begin
|
|
|
--! Cola interna de producto punto, ubicada entre el pipe line aritméco.
|
--! Cola interna de producto cccccpunto, ubicada entre el pipe line aritméco.
|
q0q1 : scfifo --! Debe ir registrada la salida.
|
q0q1 : scfifo --! Debe ir registrada la salida.
|
generic map (
|
generic map (
|
add_ram_output_register => "OFF",
|
add_ram_output_register => "OFF",
|
allow_wrcycle_when_full => "OFF",
|
allow_wrcycle_when_full => "OFF",
|
intended_device_family => "CycloneIII",
|
intended_device_family => "CycloneIII",
|
Line 105... |
Line 116... |
q => dpfifo_q,
|
q => dpfifo_q,
|
wrreq => dpfifo_wr,
|
wrreq => dpfifo_wr,
|
data => dpfifo_d
|
data => dpfifo_d
|
);
|
);
|
|
|
--! Cola interna de normalización de vectores, ubicada entre el pipeline aritmé
|
--! Cola interna de normalización de vectores, ubicada entre el pipeline aritmético
|
qxqyqz : scfifo
|
qxqyqz : scfifo
|
generic map (
|
generic map (
|
add_ram_output_register => "OFF",
|
add_ram_output_register => "OFF",
|
allow_wrcycle_when_full => "OFF",
|
allow_wrcycle_when_full => "OFF",
|
intended_device_family => "Cyclone III",
|
intended_device_family => "Cyclone III",
|
Line 169... |
Line 180... |
sint_rd_add (1)<= int_rd_add(2*widthadmemblock-1 downto widthadmemblock);
|
sint_rd_add (1)<= int_rd_add(2*widthadmemblock-1 downto widthadmemblock);
|
|
|
--! Instanciación de la cola de resultados de salida.
|
--! Instanciación de la cola de resultados de salida.
|
operands_blocks:
|
operands_blocks:
|
for i in 11 downto 0 generate
|
for i in 11 downto 0 generate
|
int_q((i+1)*width-1 downto width*i) <= s1int_q(i);
|
int_q((i+1)*floatwidth-1 downto floatwidth*i) <= s1int_q(i);
|
operandsblock : altsyncram
|
operandsblock : altsyncram
|
generic map (
|
generic map (
|
address_aclr_b => "NONE",
|
address_aclr_b => "NONE",
|
address_reg_b => "CLOCK0",
|
address_reg_b => "CLOCK0",
|
clock_enable_input_a => "BYPASS",
|
clock_enable_input_a => "BYPASS",
|
Line 190... |
Line 201... |
ram_block_type => "M9K",
|
ram_block_type => "M9K",
|
rdcontrol_reg_b => "CLOCK0",
|
rdcontrol_reg_b => "CLOCK0",
|
read_during_write_mode_mixed_ports => "OLD_DATA",
|
read_during_write_mode_mixed_ports => "OLD_DATA",
|
widthad_a => widthadmemblock,
|
widthad_a => widthadmemblock,
|
widthad_b => widthadmemblock,
|
widthad_b => widthadmemblock,
|
width_a => width,
|
width_a => floatwidth,
|
width_b => width,
|
width_b => floatwidth,
|
width_byteena_a => 1
|
width_byteena_a => 1
|
)
|
)
|
port map (
|
port map (
|
wren_a => s0ext_wr_add_one_hot(i),
|
wren_a => s0ext_wr_add_one_hot(i),
|
clock0 => clk,
|
clock0 => clk,
|
Line 212... |
Line 223... |
resultfifo_full(2) <= sresultfifo_full(4) or sresultfifo_full(2);
|
resultfifo_full(2) <= sresultfifo_full(4) or sresultfifo_full(2);
|
resultfifo_full(1) <= sresultfifo_full(3) or sresultfifo_full(2) or sresultfifo_full(1);
|
resultfifo_full(1) <= sresultfifo_full(3) or sresultfifo_full(2) or sresultfifo_full(1);
|
resultfifo_full(0) <= sresultfifo_full(0);
|
resultfifo_full(0) <= sresultfifo_full(0);
|
results_blocks:
|
results_blocks:
|
for i in 7 downto 0 generate
|
for i in 7 downto 0 generate
|
sint_d(i) <= int_d((i+1)*width-1 downto i*width);
|
sint_d(i) <= int_d((i+1)*floatwidth-1 downto i*floatwidth);
|
resultsfifo : scfifo
|
resultsfifo : scfifo
|
generic map (
|
generic map (
|
add_ram_output_register => "OFF",
|
add_ram_output_register => "OFF",
|
almost_full_value => 480,
|
almost_full_value => 480,
|
allow_wrcycle_when_full => "OFF",
|
allow_wrcycle_when_full => "OFF",
|