Multiplier:12
Register:1
VHDL CODE:
FULLY SERIAL:
FSM(control other components by 23 states):
Use IEEE.std_logic_1164.all;
ctrl_corom_en<='1'; ctrl_regfile_adr<="0010";
ctrl_regfile_adr<="0000"; temp_dav<='0';
ctrl_regfile_rden<='1'; next_state<=pres_state+1;
temp_dav<='0';
ctrl_arith<="11";
ctrl_corom_en<='0';
ctrl_arith<="01"; temp_dav<='0';
ctrl_corom_en<='1';
ctrl_regfile_rden<='1'; ctrl_arith<="00";
temp_dav<='0'; ctrl_corom_en<='1';
next_state<=pres_state+1; ctrl_corom_adr<="0011";
ctrl_regfile_rden<='1';
ctrl_arith<="10"; temp_dav<='0';
ctrl_corom_en<='0'; next_state<=pres_state+1;
ctrl_regfile_rden<='0';
next_state<=pres_state+1; ctrl_arith<="11";
ctrl_corom_en<='0';
ctrl_arith<="00"; temp_dav<='0';
ctrl_corom_en<='1'; next_state<=pres_state+1;
ctrl_corom_adr<="0010";
when 7=> ------c4*x4 ctrl_regfile_rden<='0';
ctrl_arith<="00"; temp_dav<='0';
ctrl_corom_en<='1'; next_state<=pres_state+1;
ctrl_corom_adr<="0100";
ctrl_regfile_adr<="0100"; ctrl_arith<="00";
temp_dav<='0'; ctrl_corom_en<='1';
next_state<=pres_state+1; ctrl_corom_adr<="0110";
ctrl_regfile_rden<='1';
ctrl_arith<="11"; temp_dav<='0';
ctrl_corom_en<='0'; next_state<=pres_state+1;
ctrl_regfile_rden<='0';
next_state<=pres_state+1; ctrl_arith<="11";
ctrl_corom_en<='0';
ctrl_arith<="00"; temp_dav<='0';
ctrl_corom_en<='1'; next_state<=pres_state+1;
ctrl_corom_adr<="0101";
ctrl_regfile_adr<="0101"; ctrl_arith<="00";
temp_dav<='0'; ctrl_corom_en<='1';
next_state<=pres_state+1; ctrl_corom_adr<="0111";
ctrl_regfile_rden<='1';
ctrl_arith<="11"; temp_dav<='0';
ctrl_corom_en<='0'; next_state<=pres_state+1;
ctrl_regfile_rden<='1';
ctrl_arith<="11"; temp_dav<='0';
ctrl_corom_en<='0'; next_state<=pres_state+1;
ctrl_regfile_rden<='0';
next_state<=pres_state+1; ctrl_arith<="11";
ctrl_corom_en<='0';
ctrl_arith<="00"; temp_dav<='0';
ctrl_corom_en<='1'; next_state<=pres_state+1;
ctrl_corom_adr<="1000";
ctrl_regfile_adr<="1000"; ctrl_arith<="00";
temp_dav<='0'; ctrl_corom_en<='1';
next_state<=pres_state+1; ctrl_corom_adr<="1010";
ctrl_regfile_rden<='1';
ctrl_arith<="11"; temp_dav<='0';
ctrl_corom_en<='0'; next_state<=pres_state+1;
ctrl_regfile_rden<='0';
next_state<=pres_state+1; ctrl_arith<="11";
ctrl_corom_en<='0';
ctrl_arith<="00"; temp_dav<='0';
ctrl_corom_en<='1'; next_state<=pres_state+1;
ctrl_corom_adr<="1001";
when 21=> ------c11*x11 end process;
ctrl_arith<="00";
ctrl_corom_en<='1'; process(clk,reset)
ctrl_corom_adr<="1011"; begin
ctrl_regfile_adr<="1011"; pres_state<=0;
temp_dav<='0'; else
ctrl_corom_en<='0'; end if ;
next_state<=0;
end case;
co-rom:
library IEEE; end co_rom;
use ieee.std_logic_1164.all;
begin
result:=0; rom(0):="0000000101";
adr_int:=result; rom(6):="1100000101";
rom(9):="0011011101";
rom(10):="1010000101";
begin rom(11):="0010000100";
if co_rom_en='1' then
conv_adr(co_rom_adr,conv);
process(co_rom_en,co_rom_adr) co_rom_output<=rom(conv);
delayline:
library IEEE; rd: out std_logic_vector(11 downto 0);
end entity;
entity delayline is
result := result + 1;
process( adr,rd_en)
end if;
variable conv: integer range 0 to 12;
adr_int:=result;
begin
if rd_en='1' then
end loop;
conv_adr(adr,conv);
end procedure;
rd<=mem(conv);
end if;
end process;
begin
process(wr_en)
end behave;
Arithmetic:
library IEEE; Entity arithmetic is
output<=sum;
begin
extend:=(others=>'0');
temp2:=input_co*input_x;
Entity arithmetic is
when "10"=>
port(input_co: in std_logic_vector(9 downto 0);
sum:=temp+temp2+extend;
input_x: in std_logic_vector(11 downto 0);
when "11" =>
ctrl: in std_logic_vector(1 downto 0);
sum:=sum+temp;
dav_ctrl: in std_logic;
when others=>
clk: in std_logic;
sum:=sum;
output: out std_logic_vector(25 downto 0));
end case;
end entity;
-- else sum:=sum+temp;
-- end if;
output<=sum;
begin
extend:=(others=>'0');
case ctrl is
when "00"=>
temp:=input_co*input_x;
when "01"=>
temp2:=input_co*input_x;
when "10"=>
sum:=temp+temp2+extend;
sum:=sum+temp;
when others=>
sum:=sum;
end case;
-- temp:=input_co*input_x;
output5: out std_logic_vector(11 downto 0);
end entity;
begin
process(reset, clk)
FULLY PARALLEL:
Parallel_shiftreg:
library IEEE;
begin
output7<=reg(7);
output11<=reg(11);
begin
end process;
process(reset, clk)
end behave;
variable reg :
regtype:=(others=>"000000000000");
Arithmetic: begin
else
output5<=reg(5); );
output7<=reg(7);
output9<=reg(9);
output10<=reg(10); begin
output11<=reg(11);
end process;
output1<="0000000110";
output2<="0000010101";
Parallel co_rom:
output3<="0001000100";
library IEEE;
output4<="0000100100";
use ieee.std_logic_1164.all;
output5<="1000000100";
output6<="1100000101";
output7<="0110000101";
entity rom is
output8<="0000101001";
port( output0: out std_logic_vector(9 downto 0);
output9<="0011011101";
output1: out std_logic_vector(9 downto 0);
output10<="1010000101";
output2: out std_logic_vector(9 downto 0);
output11<="0010000100";
output3: out std_logic_vector(9 downto 0);
port (input: in std_logic_vector(11 downto 0); output10: out std_logic_vector(11 downto 0);
end entity;
component rom is
port (input: in std_logic_vector(11 downto 0); output3: out std_logic_vector(9 downto 0);
output0: out std_logic_vector(11 downto 0); output5: out std_logic_vector(9 downto 0);
output1: out std_logic_vector(11 downto 0); output6: out std_logic_vector(9 downto 0);
output2: out std_logic_vector(11 downto 0); output7: out std_logic_vector(9 downto 0);
output3: out std_logic_vector(11 downto 0); output8: out std_logic_vector(9 downto 0);
output4: out std_logic_vector(11 downto 0); output9: out std_logic_vector(9 downto 0);
output5: out std_logic_vector(11 downto 0); output10: out std_logic_vector(9 downto 0);
output11: out std_logic_vector(9 downto 0) co11: in std_logic_vector(9 downto 0);
); enable,clk: in std_logic;
);
co6=>rom_arith6,co7=>rom_arith7,co8=>rom_arith8
,co9=>rom_arith9,co10=>rom_arith10,co11=>rom_a
label3: component arithmetic port map
rith11);
(enable=>enable,
clk=>clk,output=>output,x0=>reg_arith0,x1=>reg_ar
ith1,x2=>reg_arith2,x3=>reg_arith3,
x4=>reg_arith4,x5=>reg_arith5,x6=>reg_arith6,x7=>
reg_arith7,x8=>reg_arith8,x9=>reg_arith9,x10=>reg end behave;
_arith10,
Partially Parallel:
FSM:
library ieee; ctrl_rom_ad1: out std_logic_vector(3 downto 0);
--begin ctrl_rom_en<='1';
--counter<=0; ctrl_rom_ad2<="1010";
next_state<=pres_state+1;
-- process(counter)
-- begin
when 2=>
dav<=temp_dav; ctrl_arith<="00";
ctrl_rom_en<='1';
process(pres_state) ctrl_rom_ad1<="0010";
begin ctrl_rom_ad2<="1001";
temp_dav<='0'; ctrl_reg_en<='1';
ctrl_arith<="01"; next_state<=pres_state+1;
ctrl_rom_en<='1';
when 3=> next_state<=pres_state+1;
ctrl_arith<="00"; --temp_dav<='1';
ctrl_rom_en<='1';
ctrl_rom_ad2<="1000"; ctrl_arith<="11";
ctrl_reg_en<='1'; ctrl_rom_en<='1';
ctrl_reg_ad1<="0011"; ctrl_rom_ad1<="0101";
ctrl_reg_ad2<="1000"; ctrl_rom_ad2<="0110";
next_state<=pres_state+1; ctrl_reg_en<='1';
ctrl_reg_ad1<="0101";
ctrl_arith<="00"; next_state<=0;
ctrl_rom_en<='1'; temp_dav<='1';
ctrl_rom_ad1<="0100";
ctrl_reg_ad1<="0100";
next_state<=pres_state+1; begin
if reset='1' then
ctrl_arith<="00"; else
ctrl_rom_ad1<="0101"; pres_state<=next_state;
ctrl_reg_ad2<="0110";
end behave;
Reg
library IEEE; result:=0;
is if rd_en='1' then
begin conv_adr(ad2,conv2);
rd1<=mem(conv1); mem(i+1)<=mem(i);
begin
ROM:
library ieee; begin
end entity;
begin
is begin
rom(1):="0000000110";
rom(2):="0000010101"; rom(11):="0010000100";
rom(4):="0000100100"; conv_adr(ad1,conv1);
rom(5):="1000000100"; conv_adr(ad2,conv2);
rom(6):="1100000101"; co_low<=rom(conv1);
rom(7):="0110000101"; co_high<=rom(conv2);
Arithmetic:
library ieee; Architecture behave of partial_arithmetic is
use ieee.std_logic_1164.all;
process(clk)
clk: in std_logic;
begin
dav_ctrl:in std_logic;
case ctrl is
co1,co2: in std_logic_vector(9 downto 0);
when "01"=>
x1,x2: in std_logic_vector(11 downto 0);
sum1:=co1*x1;
output: out std_logic_vector(21 downto 0));
sum2:=co2*x2;
end entity;
when "00"=>
sum1:=sum1+co1*x1;
sum2:=sum2+co2*x2; if dav_ctrl='1' then
output<=sum1;
when others=>
Parital_fir
dav: out std_logic);
use ieee.std_logic_1164.all;
port(clk,reset: in std_logic;
end component;
begin
end component;
label2: component partial_rom port map
(ad1=>corom_fsm_adr1,ad2=>corom_fsm_adr2,rom
_enable=>corom_fsm_en,co_low=>co1,co_high=>co
component partial_arithmetic is
2);
port( ctrl: in std_logic_vector(1 downto 0);
clk: in std_logic;
label3: component partial_reg port map
dav_ctrl:in std_logic;
(write=>sample_in,
co1,co2: in std_logic_vector(9 downto 0); wr_en=>wr_dav,ad1=>regfile_fsm_adr1,ad2=>regfil
e_fsm_adr2,rd1=>x1,rd2=>x2,rd_en=>regfile_fsm_e
x1,x2: in std_logic_vector(11 downto 0); n);
end component;
(co1=>co1,co2=>co2,x1=>x1,x2=>x2,ctrl=>arith_fs
m,dav_ctrl=>wr_dav,clk=>clk,output=>output);
port( rom_enable: in std_logic;
end component;
component partial_fsm is
port(clk,reset:in std_logic;
ctrl_reg_ad2: out std_logic_vector(3 downto 0); output: out std_logic_vector(21 downto 0));
end component;
end component;
signal corom_fsm_en,regfile_fsm_en,wr_dav:
std_logic;
component partial_reg is
signal
port (write: in std_logic_vector(11 downto 0); corom_fsm_adr1,corom_fsm_adr2,regfile_fsm_adr1,
regfile_fsm_adr2: std_logic_vector(3 downto 0);
wr_en,rd_en: in std_logic;
signal co1,co2: std_logic_vector(9 downto 0);
ad1,ad2: in std_logic_vector(3 downto 0);
signal x1,x2: std_logic_vector (11 downto 0);
rd1,rd2: out std_logic_vector(11 downto 0));
signal arith_fsm:std_logic_vector(1 downto 0);
end component;
begin
ctrl_reg_en=>regfile_fsm_en,
ctrl_reg_ad1=>regfile_fsm_adr1,ctrl_reg_ad2=>regfi
le_fsm_adr2,dav=>wr_dav); label4: component partial_arithmetic port map
(co1=>co1,co2=>co2,x1=>x1,x2=>x2,ctrl=>arith_fs
label2: component partial_rom port map m,dav_ctrl=>wr_dav,clk=>clk,output=>output);
(ad1=>corom_fsm_adr1,ad2=>corom_fsm_adr2,rom
_enable=>corom_fsm_en,co_low=>co1,co_high=>co dav<=wr_dav;
2);
end behave;
label3: component partial_reg port map