1/1

|
vhdl cordic help
by qiulu on May 10, 2012 |
qiulu
Posts: 1 Joined: May 9, 2012 Last seen: Jan 24, 2013 |
||
|
below is my vhdl code which use cordic to implement the multiply.how can i short the clk that need to implment one multiplu operation:
library ieee; use ieee.std_logic_1164.all; --use ieee.std_logic_arith.all; use ieee.numeric_std.all ; entity vhdl1 is port( x_i : in signed (15 downto 0); z_i : in signed (15 downto 0); y_i : in signed (15 downto 0); clk : in std_logic; x_o :out signed (31 downto 0); y_o :out signed (31 downto 0); z_o :out signed (31 downto 0) ); end entity vhdl1; architecture beh of vhdl1 is type YVector is array(15 downto 0) of signed(31 downto 0); type ZVector is array(15 downto 0) of signed(31 downto 0); type XVector is array(15 downto 0) of signed(31 downto 0); signal Y : YVector; signal Z : ZVector; signal x : XVector; function shiftleft(Arg : signed; Cnt : natural) return signed is variable tmp : signed(31 downto 0); --constant lo : integer := Arg'high -cnt +1; --constant lo:integer:=cnt; begin tmp:=arg; for n in 1 to cnt loop tmp(31):=tmp(31); tmp(30 downto 1):=tmp(29 downto 0); tmp(0):='0'; end loop; -- for n in Arg'high-1 downto lo loop -- tmp(n) := tmp(n-cnt); --end loop; --for n in cnt-1 downto 0 loop -- tmp(n) := '0'; --end loop; --tmp(7) := arg(7); return tmp; end function shiftleft; begin x(0) y(0) z(0) process(clk) begin if clk'event and clk='1' then ------------------------------------------------------------------------------- if(z(15)then x_o y_o z_oelsif(z(15)=0) then x_oy_oz_oelse x_o y_o z_oend if; --------------------------------------------------------------------------- if(z(14)then x(15) y(15) z(15) elsif(z(14)=0) then x_oy_oz_oelse x(15) y(15) z(15)end if; --------------------------------------------------------------------------- if(z(13)then x(14) y(14) z(14) elsif(z(13)=0) then x_oy_oz_oelse x(14) y(14) z(14)end if; --------------------------------------------------------------------------------------- if(z(12)then x(13) y(13) z(13) elsif(z(12)=0) then x_oy_oz_oelse x(13) y(13) z(13)end if; ----------------------------------------------------------------------------------------- if(z(11)then x(12) y(12) z(12) elsif(z(11)=0) then x_oy_oz_oelse x(12) y(12) z(12)end if; ----------------------------------------------------------------------------------- if(z(10)then x(11) y(11) z(11) elsif(z(10)=0) then x_oy_oz_oelse x(11) y(11) z(11)end if; --------------------------------------------------------------------------------- if(z(9)then x(10) y(10) z(10) elsif(z(9)=0) then x_oy_oz_oelse x(10) y(10) z(10)end if; ---------------------------------------------------------------------------------- if(z(8)then x(9) y(9) z(9) elsif(z(8)=0) then x_oy_oz_oelse x(9) y(9) z(9)end if; ------------------------------------------------------------------------------ if(z(7)then x(8) y(8) z(8) elsif(z(7)=0) then x_oy_oz_oelse x(8) y(8) z(8)end if; -------------------------------------------------------------------- if(z(6)then x(7)y(7)z(7)elsif(z(6)=0) then x_oy_oz_oelse x(7)y(7)z(7)end if; ------------------------------------------------------------- if(z(5)then x(6)y(6)z(6)elsif(z(5)=0) then x_oy_oz_oelse x(6)y(6)z(6)end if ; ------------------------------------------------------------------ if(z(4)then x(5)y(5)z(5)elsif(z(4)=0) then x_oy_oz_oelse x(5)y(5)z(5)end if; ----------------------------------------------------------------- if(z(3)then x(4)y(4)z(4)elsif(z(3)=0) then x_oy_oz_oelse x(4)y(4)z(4)end if ; --third -------------------------------------------------------------------- if(z(2)then x(3)y(3)z(3)elsif(z(2)=0) then x_oy_oz_oelse x(3)y(3)z(3)end if ; ------------------------------------------------------------------------- if(z(1)then x(2)y(2)z(2)elsif(z(1)=0) then x_oy_oz_oelse x(2)y(2)z(2)end if ; ---------------------------------------------------------------------- if(z(0)then x(1)y(1)z(1)elsif(z(0)=0) then x_oy_oz_oelse x(1)y(1)z(1)end if; end if; end process; end beh; |
|||
1/1

