Foros del Web » Programación para mayores de 30 ;) » Programación General »

ayuda con concatenacion

Estas en el tema de ayuda con concatenacion en el foro de Programación General en Foros del Web. Hola a todos, estoy construyendo una alu para punto flotante y necesito usar el operador '&' para concatenar dos stdlogicvector o alguna rutina que lo ...
  #1 (permalink)  
Antiguo 29/04/2007, 20:42
 
Fecha de Ingreso: abril-2007
Mensajes: 1
Antigüedad: 17 años
Puntos: 0
ayuda con concatenacion

Hola a todos, estoy construyendo una alu para punto flotante y necesito usar el operador '&' para concatenar dos stdlogicvector o alguna rutina que lo haga. Ya intente varias cosas y no sale.
Esto es por las lineas 140 and 250.
Estoy usando quartus II. en el compilador aparece el siguiente error

Error: Assertion error: Value of LPM_DIRECTION parameter (ADD) is not consistent with the use of the add_sub port
Error: Can't elaborate inferred hierarchy "lpm_add_sub:Add5"

Supongo que el error es en estas lineas y en esa operacion por que si ellas compila bien


library ieee;
--use ieee.std_logic_signed.all;
use IEEE.std_logic_unsigned.all;
use ieee.std_logic_1164.all;
--use work.all;
use ieee.std_logic_arith.all;
--USE ieee.numeric_bit.all;
--USE ieee.numeric_std.all;

ENTITY alu IS PORT (
se1,se2: IN bit;
sm1,sm2: IN bit;
m1,m2: IN std_logic_vector(31 downto 0);
e1: IN std_logic_vector(67 DOWNTO 64);
e2: IN std_logic_vector(71 DOWNTO 68);

op: in std_Ulogic_vector(73 downto 72);

se: OUT bit;
sm: OUT bit;
m: OUT std_logic_vector(63 DOWNTO 0);
e: OUT std_logic_vector(75 DOWNTO 72));
END alu;

ARCHITECTURE proceso OF alu IS

BEGIN

process(se1,se2,sm1,sm2,m1,m2,e1,e2,op)

variable tem: std_logic_vector(3 downto 0);

variable e_mayor: std_logic_vector(3 DOWNTO 0);
variable e_menor: std_logic_vector(7 DOWNTO 4);
variable se_mayor: bit;
variable se_menor: bit;

variable cse1,cse2: bit;
variable cse: bit;
variable csm1,csm2: bit;
variable csm: bit;
variable cm1,cm2: std_logic_vector(31 downto 0);
variable cm: std_logic_vector(63 DOWNTO 0);
variable cmpeque: std_logic_vector(31 DOWNTO 0);
variable ce1: std_logic_vector(67 DOWNTO 64);
variable ce2: std_logic_vector(71 DOWNTO 68);
variable ce: std_logic_vector(75 DOWNTO 72);

variable tm:std_logic_vector(31 downto 0);
variable tsm:bit;
variable te:std_logic_vector(3 downto 0);
variable tse:bit;

variable mb: bit_vector(63 downto 0);
variable mb2: bit_vector(31 downto 0);
variable mb1: bit_vector(63 downto 0);
variable que: SMALL_INT;
variable ban: std_Ulogic;

variable v0: std_logic_vector(31 downto 0);

variable i,entera,uno,dos: integer;

begin

cse1:=se1;
csm1:=sm1;
cm1:=m1;
ce1:=e1;

cse2:=se2;
csm2:=sm2;
cm2:=m2;
ce2:=e2;



CASE op IS
WHEN "00" => --suma
que:=0;

--exponentes
if ( cse1='0' and cse2='1') then -- + -
tem:=ce1+ce2;
elsif ( cse1='1' and cse2='0') then -- - +
tem:=ce1+ce2;
--tre:= reg1; reg1:=reg2; reg2:=tre; intercambio
tm:=cm1; tsm:=csm1; te:=ce1; tse:=cse1;
cm1:=cm2; csm1:=csm2; ce1:=ce2; cse1:=cse2;
cm2:=tm; csm2:=tsm; ce2:=te; cse2:=tse;
--
elsif (cse1='1' and cse2='1') then -- - -
if (ce1>ce2) then
tem:=ce1-ce2;
--tre:= reg1; reg1:=reg2; reg2:=tre; intercambio
tm:=cm1; tsm:=csm1; te:=ce1; tse:=cse1;
cm1:=cm2; csm1:=csm2; ce1:=ce2; cse1:=cse2;
cm2:=tm; csm2:=tsm; ce2:=te; cse2:=tse;
--
elsif (ce1<ce2) then
tem:=ce2-ce1;
else tem:="0000";
end if;
elsif (cse1='0' and cse2='0') then -- + +
if (ce1>ce2) then
tem:=ce1-ce2;
elsif (ce1<ce2) then
tem:=ce2-ce1;
else tem:="0000";
end if;
end if;

ce:=ce1; cse:=cse1;


entera:=CONV_INTEGER(tem);

mb2:= To_bitvector(cm2);

mb2:=mb2 srl entera;

cm2:= To_StdLogicVector(mb2);

--------------------------------------mantisas
if csm1 /= csm2 then
if cm1 > cm2 then
cm1:= not cm1; cm1:= cm1+'1'; -- c2
ban:='1';
elsif cm1 < cm2 then
cm2:= not cm2; cm2:= cm2+'1'; -- c2
ban:='1';
else cmpeque:="00000000000000000000000000000000";
end if;
elsif csm1=csm2 then
csm:=csm1;
end if;

cmpeque:=cm1+cm2; --suma


v0:="10000000000000000000000000000000";
--cm:=(v0 & cmpeque); ----Esta parte es la que necesito AYUDA
--Normalizacion

while cm'left=0 loop
--mb:= mb sll 1;
-- cm:=cm sll 1;
entera:=0;
for i in 1 downto 63 loop -- sll
cm(i):=cm(entera);
entera:=entera+1;
end loop;
cm(0):='0';

if (cse='0') and (ce>0) then
ce:= ce-'1';
elsif ce="0000" then
ce:= ce+'1';
cse:= '1';
elsif cse='1' then
ce:= ce+'1';
end if;
end loop;-- while

e<=ce;
m<=cm;
se<=cse;
sm<=csm;

WHEN "01" => -- resta
que:=0;


--exponentes
if ( cse1='0' and cse2='1') then -- + -
tem:=ce1+ce2;
elsif ( cse1='1' and cse2='0') then -- - +
tem:=ce1+ce2;
--tre:= reg1; reg1:=reg2; reg2:=tre; intercambio
tm:=cm1; tsm:=csm1; te:=ce1; tse:=cse1;
cm1:=cm2; csm1:=csm2; ce1:=ce2; cse1:=cse2;
cm2:=tm; csm2:=tsm; ce2:=te; cse2:=tse;
--
elsif (cse1='1' and cse2='1') then -- - -
if (ce1>ce2) then
tem:=ce1-ce2;
--tre:= reg1; reg1:=reg2; reg2:=tre; intercambio
tm:=cm1; tsm:=csm1; te:=ce1; tse:=cse1;
cm1:=cm2; csm1:=csm2; ce1:=ce2; cse1:=cse2;
cm2:=tm; csm2:=tsm; ce2:=te; cse2:=tse;
--
elsif (ce1<ce2) then
tem:=ce2-ce1;
else tem:="0000";
end if;
elsif (cse1='0' and cse2='0') then -- + +
if (ce1>ce2) then
tem:=ce1-ce2;
elsif (ce1<ce2) then
tem:=ce2-ce1;
else tem:="0000";
end if;
end if;

ce:=ce1; cse:=cse1;

entera:=CONV_INTEGER(tem);

mb2:= To_bitvector(cm2);

mb2:=mb2 srl entera;

cm2:= To_StdLogicVector(mb2);

--mantisas
if ( csm1='0' and csm2='1') then -- + -
cmpeque:=cm1+cm2;
csm:='0';
elsif ( csm1='1' and csm2='0') then -- - +
csm:='1';
cmpeque:=cm1+cm2;
elsif (csm1='0' and csm2='0') then -- + +
cm1:=not cm1; cm1:=cm1+'1';
if (cm1>cm2) then
csm:='0';
else
csm:='1';
end if;
cmpeque:=cm1+cm2;
cmpeque:=not cmpeque; cmpeque:=cmpeque+'1';--c2
elsif (csm1='1' and csm2='1') then -- - -
if (cm1>cm2) then
cm1:=not cm1; cm1:=cm1+'1';--c2
csm:='1';
elsif (cm1<=cm2) then
csm:='0';
cm2:=not cm2; cm2:=cm2+'1';--c2
end if;
cmpeque:=cm1+cm2;
cmpeque:=not cmpeque; cmpeque:=cmpeque+'1';--c2
end if;

--v0:="10000000000000000000000000000000";
--cm:=(v0 & cmpeque);
cm:="00000000000000000000000000000000"&cmpeque(31 downto 0); ----Esta parte es la que necesito AYUDA
--Normalizacion

while cm'left=0 loop
--mb:= mb sll 1;
-- cm:=cm sll 1;
entera:=0;
for i in 1 downto 63 loop -- sll
cm(i):=cm(entera);
entera:=entera+1;
end loop;
cm(0):='0';

if (cse='0') and (ce>0) then
ce:= ce-'1';
elsif ce="0000" then
ce:= ce+'1';
cse:= '1';
elsif cse='1' then
ce:= ce+'1';
end if;
end loop;-- while

e<=ce;
m<=cm;
se<=cse;
sm<=csm;

WHEN "10" => -- multiplicacion
que:=1;
csm:=csm1 xor csm2; --Signo de la matiza resultado

--calculo y signo de exponente

if cse1=cse2 then
ce := ce1 + ce2;
cse:=cse1;
else
if ce1<ce2 then
e_mayor:=ce2;
se_mayor:=cse2;
e_menor:=ce1;
se_menor:=cse1;
else
e_mayor:=ce1;
se_mayor:=cse1;
e_menor:=ce2;
se_menor:=cse2;
end if;
ce:=e_mayor-e_menor;
cse:=se_mayor;
end if;

--Multiplicacion de las mantizas

cm:=cm1*cm2;


while cm'left=0 loop
--mb:= mb sll 1;
-- cm:=cm sll 1;
entera:=0;
for i in 1 downto 63 loop -- sll
cm(i):=cm(entera);
entera:=entera+1;
end loop;
cm(0):='0';

if (cse='0') and (ce>0) then
ce:= ce-'1';
elsif ce="0000" then
ce:= ce+'1';
cse:= '1';
elsif cse='1' then
ce:= ce+'1';
end if;
end loop;-- while

e<=ce;
m<=cm;
se<=cse;
sm<=csm;

WHEN "11" => -- division
que:=1;
--Valoraciones

csm:=csm1 xor csm2; --Signo de la mantiza resultado

--calculo y signo de exponente

if cse1=cse2 then
if cse1='0' and cse2='0' then
if ce1<ce2 then
ce:=ce2-ce1;
cse:='1';
elsif ce1>ce2 then
ce:=ce1-ce2;
cse:=se1;
else
ce:=ce1-ce2;--0;
cse:='0';
end if;
elsif cse1='1' and cse2='1' then
if ce1<ce2 then
ce:=ce2-ce1;
cse:='0';
elsif cse1>cse2 then
ce:=ce1-ce2;
cse:='1';
else
ce:=ce1-ce2;--"0";
cse:='0';
end if;
end if;
else
if cse1='1' then
ce:=ce1+ce2;
cse:='1';
elsif cse1='0' then
ce:=ce1+ce2;
cse:='0';
end if;
end if;

--Division de las mantizas
uno:=conv_integer(cm1);
dos:=conv_integer(cm2);
entera:=uno/dos;
cm:=CONV_std_logic_vector(entera,64);--cm:=cm1 / cm2;

--cse:=se;
--ce:=e;

while cm'left=0 loop
--mb:= mb sll 1;
-- cm:=cm sll 1;
entera:=0;
for i in 1 downto 63 loop -- sll
cm(i):=cm(entera);
entera:=entera+1;
end loop;
cm(0):='0';

if (cse='0') and (ce>0) then
ce:= ce-'1';
elsif ce="0000" then
ce:= ce+'1';
cse:= '1';
elsif cse='1' then
ce:= ce+'1';
end if;
end loop;-- while

e<=ce;
m<=cm;
se<=cse;
sm<=csm;
END CASE;

end process;

END proceso;
  #2 (permalink)  
Antiguo 30/04/2007, 05:01
Avatar de JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 2 meses
Puntos: 772
Re: ayuda con concatenacion

Hola abner_q. Bienvenido al foro.

Para preguntas concretas es preferible utilizar el foro que mejor se adapte a tu duda, así podrán ayudarte más usuarios.

Muevo tu mensaje al foro de Programación desde Bienvenida a Foros del Web.

Saludos,
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:34.