<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community - Legacy and Other Languages</title>
		<link>http://www.daniweb.com/forums/</link>
		<description><![CDATA[Our Legacy Languages forum is the place for Q&A-style discussions related to programming languages that are either depreciated or not popular enough to warrant their own forum. Please only post here if you're positive that we don't already have a more appropriate forum.]]></description>
		<language>en-US</language>
		<lastBuildDate>Sun, 08 Nov 2009 03:29:19 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - Legacy and Other Languages</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>Urgent help with vhdl neeeded</title>
			<link>http://www.daniweb.com/forums/thread236766.html</link>
			<pubDate>Sat, 07 Nov 2009 11:48:36 GMT</pubDate>
			<description>Hi people, I need help to produce a VHDL behavioral code for my final year project, I need to create a 256 point radix-2 fft processor on a spartan-3A DSP FPGA and I am so stuck using modelsim and XILINX 10.1, I have reached to this point  the code is below anyone who can get out the syntax error...</description>
			<content:encoded><![CDATA[<div>Hi people, I need help to produce a VHDL behavioral code for my final year project, I need to create a 256 point radix-2 fft processor on a spartan-3A DSP FPGA and I am so stuck using modelsim and XILINX 10.1, I have reached to this point  the code is below anyone who can get out the syntax error and how to declare shared variable I would appreciate.......<br />
-- THIS FILE DECLARES THE SIGNALS USED IN THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
package butter_lib is<br />
<br />
signal ram_data,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,out_data : std_logic_vector(31 downto 0) := (others =&gt; '0') ;<br />
signal data_rom , rom_ff : std_logic_vector(31 downto 0) ;<br />
signal clock_main , reset , enbl , clock : std_logic := '0' ;<br />
signal c0 , c1 , c2 , c3 , c0_c1 , c2_c3 , c0_c2 , c1_c3 : std_logic ;<br />
signal c0_and,c1_and,c2_and,c3_and,c0_c1and,c2_c3and,c0_c2and,c1_c3and : std_logic ;<br />
signal reset_count : std_logic ;<br />
type state is (reset1 , reset2 , reset3 , reset4 , reset5 , reset6 , reset7) ;<br />
<br />
signal final_sum : std_logic_vector (31 downto 0) := (others =&gt; '0') ;<br />
signal shift , finish_sum , signbit , normalise , end_all , a_small , addsub ,sum_out2 , shift_done , done , num_rec , setbit ,  addpulse : std_logic := '0' ;<br />
signal shift_outa , swap_num2 : std_logic_vector ( 31 downto 0 ) := (others =&gt; '0') ;<br />
signal swap_num1 , sum_out : std_logic_vector (32 downto 0) := (others =&gt; '0') ;<br />
signal sub2 : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal suba : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal exp : std_logic_vector (7 downto 0) := (others =&gt; '0') ;<br />
signal rst , enswap , ensub , enshift , finsub , finswap , finshift , numzero : std_logic := '0' ;<br />
signal zerodetect : std_logic_vector(1 downto 0) ;<br />
signal changea : std_logic ;<br />
<br />
signal final_sumb : std_logic_vector (31 downto 0) := (others =&gt; '0') ;<br />
signal shiftb , finish_sumb , signbitb , normaliseb , end_allb , a_smallb , addsubb,sum_out2b , shift_doneb , doneb , num_recb , setbitb ,  addpulseb , clockb : std_logic := '0' ;<br />
signal shift_outb , swap_num2b : std_logic_vector ( 31 downto 0 ) := (others =&gt; '0') ;<br />
signal swap_num1b , sum_outb : std_logic_vector (32 downto 0) := (others =&gt; '0') ;<br />
signal sub2b : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal subb : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal expb: std_logic_vector (7 downto 0) := (others =&gt; '0') ;<br />
signal rstb , enswapb , ensubb , enshiftb , finsubb , finswapb , finshiftb , numzerob , clock_mainb , resetb , enblb : std_logic := '0' ;<br />
signal zerodetectb : std_logic_vector(1 downto 0) ;<br />
signal changeb : std_logic ;<br />
<br />
signal incr , clear , io_mode , staged , iod : std_logic ;<br />
signal butterfly,fftadd_rd,shift1,shift3,shift4,shift5,shift6,ram_wr,ram_rd,io_add : std_logic_vector(3 downto 0) := (others =&gt; '0') ;<br />
signal fftd , fft_en , ip , op , init : std_logic ;<br />
signal stage : std_logic_vector(1 downto 0) ;<br />
--signal clock_main,c0,c1,c2,c3,c0_c1,c2_c3,c0_c2,c1_c3 : std_logic ;<br />
signal preset,disable,c0_en,rom_en,romgen_en : std_logic ;<br />
signal clk_count : std_logic_vector(2 downto 0) ;<br />
signal enbw , enbor : std_logic ;<br />
signal data_io : std_logic_vector(31 downto 0) := (others =&gt; '0') ;<br />
signal rom_add : std_logic_vector(2 downto 0) ;<br />
type state_values is (st0 , st1 , st2 ,  st3) ;<br />
signal pres_state1 , next_state1 : state_values ;<br />
<br />
signal butterfly_iod : std_logic_vector(3 downto 0) ;<br />
signal cyc_clear : std_logic ;<br />
signal add_rd , add_wr : std_logic_vector(3 downto 0) ;  <br />
<br />
end butter_lib ;<br />
<br />
--THIS FILE RECEIVES THE OUTPUT OF THE WAVEFORM GENERATOR AND <br />
--OUTPUTS THE REQUIRED CYCLES<br />
<br />
library ieee;<br />
use ieee.std_logic_1164.all;<br />
use IEEE.std_logic_arith.all;<br />
use IEEE.std_logic_unsigned.all;<br />
use work.butter_lib.all ;<br />
<br />
entity and_gates is<br />
port (<br />
      waves_and : in std_logic_vector(3 downto 0) ;<br />
      clock_main , c0_en : in std_logic ;<br />
      c0,c1,c2,c3 : out std_logic ;<br />
      c0_c1,c2_c3,c0_c2,c1_c3 : out std_logic ) ;<br />
end and_gates ;<br />
<br />
architecture rtl of and_gates is<br />
begin <br />
process(clock_main,waves_and)<br />
begin<br />
if (c0_en = '1' and clock_main='1') then<br />
<br />
c0 &lt;= waves_and(3) ;<br />
c1 &lt;= waves_and(2) ;<br />
c2 &lt;= waves_and(1) ;<br />
c3 &lt;= waves_and(0) ;<br />
c0_c1 &lt;= waves_and(3) or waves_and(2) ;<br />
c0_c2 &lt;= waves_and(3) or waves_and(1) ;<br />
c2_c3 &lt;= waves_and(1) or waves_and(0) ;<br />
c1_c3 &lt;= waves_and(0) or waves_and(2) ;<br />
else <br />
c0 &lt;= '0' ;<br />
c1 &lt;= '0' ;<br />
c2 &lt;= '0' ;<br />
c3 &lt;= '0' ;<br />
c0_c1 &lt;= '0' ;<br />
c0_c2 &lt;= '0' ;<br />
c2_c3 &lt;= '0' ;<br />
c1_c3 &lt;= '0' ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
--BASE INDEX GENERATOR<br />
library ieee;<br />
use ieee.std_logic_1164.all;<br />
use work.butter_lib.all ;<br />
<br />
entity baseindex is<br />
 port(<br />
   ind_butterfly: in std_logic_vector(3 downto 0);<br />
   ind_stage: in std_logic_vector(1 downto 0);<br />
   add_fft: in std_logic;<br />
   fftadd_rd: out std_logic_vector(3 downto 0);<br />
   c0,c1,c2,c3: in std_logic);<br />
end baseindex;<br />
<br />
architecture rtl of baseindex is<br />
begin<br />
process(ind_butterfly,ind_stage,add_fft,c0,c1,c2,c3)<br />
variable out_sig : std_logic_vector(3 downto 0);<br />
begin<br />
if (add_fft='1') then<br />
if(c2='1') then -- address for 'x'. Since this is the real part, <br />
case ind_stage is -- M.S.B is '0'.<br />
   when &quot;00&quot; =&gt; out_sig := &quot;00&quot; &amp; ind_butterfly(1 downto 0);<br />
   when &quot;01&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1) &amp; '0' &amp; ind_butterfly(0);<br />
-- when &quot;10&quot; =&gt; out_sig := '0' &amp; '1' &amp; '1' &amp; ind_butterfly(3);<br />
   when &quot;10&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1 downto 0) &amp; '0';<br />
   when others =&gt; out_sig := &quot;0000&quot;;<br />
end case;<br />
 <br />
elsif(c0='1') then -- address for 'y'.<br />
case ind_stage is<br />
  when &quot;00&quot; =&gt; out_sig := &quot;01&quot; &amp; ind_butterfly(1 downto 0);<br />
  when &quot;01&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1) &amp; '1' &amp; ind_butterfly(0);<br />
  when &quot;10&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1 downto 0) &amp; '1';<br />
  when others =&gt; out_sig := &quot;0000&quot;;<br />
end case;<br />
<br />
elsif(c1='1') then -- addresss for 'Y'<br />
case ind_stage is<br />
  when &quot;00&quot; =&gt; out_sig := &quot;11&quot; &amp; ind_butterfly(1 downto 0);<br />
  when &quot;01&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1) &amp; '1' &amp; ind_butterfly(0);<br />
  when &quot;10&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1 downto 0) &amp; '1';<br />
  when others =&gt; out_sig := &quot;0000&quot;;<br />
end case;<br />
<br />
elsif(c3='1') then -- address for 'X'<br />
case ind_stage is<br />
 when &quot;00&quot; =&gt; out_sig := &quot;10&quot; &amp; ind_butterfly(1 downto 0);<br />
  when &quot;01&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1) &amp; '0' &amp; ind_butterfly(0);<br />
  when &quot;10&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1 downto 0) &amp; '0';<br />
  when others =&gt; out_sig := &quot;0000&quot;;<br />
--else<br />
--out_sig := &quot;ZZZZ&quot;;<br />
end case;<br />
end if;<br />
end if;<br />
fftadd_rd &lt;= out_sig (3 downto 0) ;<br />
end process;<br />
end rtl;<br />
-- BUTTERFLY GENERATOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity but_gen is<br />
port (<br />
      add_incr , add_clear , stagedone : in std_logic ;<br />
      but_butterfly : out std_logic_vector(3 downto 0) ) ;<br />
end but_gen ;<br />
<br />
architecture rtl of but_gen is<br />
begin<br />
process(add_clear , add_incr , stagedone)<br />
variable cnt : integer ;<br />
variable count : std_logic_vector(3 downto 0) ;<br />
begin<br />
if(add_clear = '1' or stagedone = '1') then<br />
count := &quot;0000&quot; ;<br />
but_butterfly &lt;= &quot;0000&quot; ;<br />
elsif (add_incr'event and add_incr = '1') then<br />
but_butterfly &lt;= (count + 1) ;<br />
count := count + 1 ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
 <br />
entity control_main is<br />
port ( <br />
       a_small , sign_a , sign_b : in std_logic ;<br />
       sign_out , add_sub , reset_all : out std_logic ;<br />
       en_sub , en_swap , en_shift , addpulse , normalise : out std_logic ;<br />
       fin_sub , fin_swap , finish_shift , add_finish , end_all : in std_logic ;<br />
       clock_main , clock , reset , enbl , zero_num , change: in std_logic ) ;<br />
end control_main ; <br />
 <br />
architecture rtl of control_main is<br />
signal current_state , next_state : state ;<br />
begin<br />
process (current_state , add_finish , finish_shift , end_all , enbl , clock_main , fin_sub , fin_swap , zero_num , change)<br />
begin<br />
<br />
case current_state is<br />
 when reset1 =&gt;<br />
  if( enbl = '1' and clock_main = '1') then<br />
  normalise &lt;= '0' ;<br />
  addpulse &lt;= '0' ;<br />
  reset_all &lt;= '1' ;<br />
  next_state &lt;= reset2 ;<br />
  elsif ( enbl = '0') then<br />
  next_state &lt;= reset7 ;-- last state to exit <br />
  else <br />
  next_state &lt;= reset1 ;<br />
  end if ;<br />
<br />
 when reset2 =&gt;<br />
  reset_all &lt;= '0' ; -- else values willnot cchange<br />
  en_sub &lt;= '1' ;<br />
  en_swap &lt;= '1' ;<br />
  next_state &lt;= reset3 ;<br />
<br />
 when reset3 =&gt;<br />
  if (zero_num = '1') then<br />
  next_state &lt;= reset5 ;<br />
  en_sub &lt;= '0' ;<br />
  en_swap &lt;= '0' ;<br />
  elsif(fin_sub= '1') then<br />
  if(fin_swap = '1') then<br />
  en_shift &lt;= '1' ;<br />
  en_sub &lt;= '0' ;<br />
  en_swap &lt;= '0' ;<br />
  next_state &lt;= reset4 ;<br />
  end if ;<br />
  else<br />
  next_state &lt;= reset3 ;<br />
  end if ;<br />
  <br />
 when reset4 =&gt;<br />
 if (finish_shift = '1') then<br />
 en_shift &lt;= '0' ;<br />
 addpulse &lt;= '1' ;<br />
 next_state &lt;= reset5 ;<br />
 else<br />
 next_state &lt;= reset4 ;<br />
 end if ;<br />
<br />
 when reset5 =&gt;<br />
 if (zero_num = '1') then<br />
 normalise &lt;= '1' ;<br />
 next_state &lt;= reset6 ;<br />
 elsif (add_finish = '1') then<br />
 normalise &lt;= '1' ;<br />
 addpulse &lt;= '0' ;<br />
 next_state &lt;= reset6 ;<br />
 else<br />
 next_state &lt;= reset5 ;<br />
 end if ;<br />
 <br />
 when reset6 =&gt;<br />
 if (end_all = '1' and clock_main = '1') then<br />
 normalise &lt;= '0' ;<br />
 next_state &lt;= reset6 ;<br />
 elsif (end_all = '1' and clock_main = '0') then<br />
 next_state &lt;= reset1 ;<br />
 else<br />
 next_state &lt;= reset6 ;<br />
 end if ;<br />
<br />
 when reset7 =&gt;<br />
 next_state &lt;= reset7 ;<br />
<br />
 when others =&gt;<br />
 next_state &lt;= reset1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock , reset , change)<br />
begin<br />
if(change = '1') then<br />
current_state &lt;= reset1 ;<br />
elsif (reset = '1') then<br />
current_state &lt;= reset1 ;<br />
elsif (clock= '1' and clock'event) then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
<br />
process (a_small , sign_a , sign_b)<br />
begin<br />
if (sign_a = '0' and sign_b = '0') then<br />
sign_out &lt;= '0' ;<br />
add_sub &lt;= '1' ;<br />
<br />
elsif (sign_a = '1' and sign_b = '1') then<br />
sign_out &lt;= '1' ;<br />
add_sub &lt;= '1' ;<br />
<br />
elsif (a_small = '1' and sign_a = '0') then<br />
sign_out &lt;= '1' ;<br />
add_sub &lt;= '0' ;<br />
<br />
elsif (a_small = '0' and sign_a = '1') then<br />
sign_out &lt;= '1' ;<br />
add_sub &lt;= '0' ;<br />
<br />
else <br />
sign_out &lt;= '0' ;<br />
add_sub &lt;= '0' ;<br />
end if ;<br />
<br />
end process ;<br />
<br />
end rtl ;<br />
-- THIS FILE COUNTS THE NUMBER OF CYCLES AFTER FFT COMPUTATION IS ENABLED.<br />
-- THIS IS REQUIRED BECAUSE WRITING INTO THE RAM BEGINS ONLY AFTER 5 CYCLES (DURING C1)<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity counter is<br />
port (<br />
      c : out std_logic_vector(2 downto 0) ;<br />
      disable , clock_main , reset : in std_logic) ;<br />
end counter ;<br />
<br />
architecture rtl of counter is <br />
begin<br />
process (reset , clock_main , disable)<br />
variable temp : std_logic_vector(2 downto 0) ;<br />
begin<br />
 if (disable &lt;= '0') then<br />
 if(reset = '1') then<br />
 c &lt;= &quot;000&quot; ;<br />
 temp := &quot;000&quot; ;<br />
 elsif(clock_main = '1' and clock_main'event) then<br />
 c &lt;= (temp + 1) ;<br />
 temp := temp + 1 ;<br />
 end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- POSITIVE EDGE TRIGGERED FLIPFLOPS PLACED BEFORE THE DIVIDE BY TWO UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity level_edge is <br />
 port (<br />
       data_edge : in std_logic_vector(31 downto 0) ;<br />
       trigger_edge : in std_logic ;<br />
       edge_out : out std_logic_vector(31 downto 0) ) ;<br />
end level_edge ;<br />
<br />
architecture rtl of level_edge is<br />
begin<br />
process(data_edge , trigger_edge)<br />
begin<br />
if (trigger_edge='1' and trigger_edge'event) then<br />
edge_out &lt;= data_edge(31 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- DIVIDE BY TWO UNIT. THIS FILE HOWEVER PASSED THE DATA UNCHANGED<br />
-- BECAUSE DIVISION IS REQUIRED ONLY IF SCALING IS USED TO AVOID OVERFLOW.<br />
--  NO SCALING WAS USED IN THIS PROJECT, SO THAT RESULTS OF MATLAB MATCHED WITH OURS<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity divide is <br />
 port (<br />
       data_in : in std_logic_vector(31 downto 0) ;<br />
       data_out : out std_logic_vector(31 downto 0) ) ;<br />
end divide ;<br />
 <br />
architecture rtl of divide is<br />
begin<br />
process(data_in)<br />
variable divide_exp : std_logic_vector(7 downto 0) ;<br />
variable divide_mant : std_logic_vector(31 downto 0) ;<br />
begin<br />
if (data_in = &quot;00000000000000000000000000000000&quot;) then <br />
data_out &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
elsif (data_in = &quot;10000000000000000000000000000000&quot;) then<br />
data_out &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
else<br />
divide_exp := data_in(30 downto 23) ;<br />
divide_mant := data_in (31 downto 0) ;<br />
divide_exp := divide_exp - &quot;00000001&quot; ;<br />
--data_out &lt;= divide_mant(31) &amp; divide_exp(7 downto 0) &amp; divide_mant(22 downto 0)  ;<br />
data_out &lt;= data_in(31 downto 0) ; -- pass data unchanged<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- IO ADDRESS GENERATOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity ioadd_gen is<br />
port (<br />
      io_butterfly : in std_logic_vector(3 downto 0) ;<br />
      add_iomode , add_ip , add_op : in std_logic ;<br />
      base_ioadd : out std_logic_vector(3 downto 0) ) ;<br />
end ioadd_gen ;<br />
<br />
architecture rtl of ioadd_gen is<br />
begin<br />
process(io_butterfly , add_iomode , add_ip , add_op)<br />
variable out_data : std_logic_vector(3 downto 0) ;<br />
begin<br />
if(add_iomode = '1') then<br />
 if (add_ip = '1') then<br />
  out_data := io_butterfly(3 downto 0) ;<br />
 elsif(add_op = '1') then<br />
  if(io_butterfly(3) = '0') then -- ie, real part<br />
  out_data := '0' &amp; io_butterfly(0) &amp; io_butterfly(1) &amp; io_butterfly(2) ;<br />
  elsif(io_butterfly(3)='1') then -- ie, complex part<br />
  out_data := '1' &amp; io_butterfly(0) &amp; io_butterfly(1) &amp; io_butterfly(2) ;<br />
  end if ;<br />
 end if ;<br />
end if ;<br />
base_ioadd &lt;= out_data(3 downto 0) ;<br />
end process ;<br />
end rtl ;<br />
<br />
-- THIS FILE OUTPUTS THE &quot;IO DONE&quot; AND &quot;STAGE DONE&quot; AND &quot;FFT DONE&quot; SIGNALS AT THE <br />
-- CORRECT TIME. IT ALSO RECEIVES THE OUTPUT OF THE BUTTERFLY GENERATOR<br />
-- AND OUTPUTS IT UNCHANGED.<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity iod_staged is<br />
port (<br />
      but_fly : in std_logic_vector(3 downto 0) ;<br />
      stage_no : in std_logic_vector(1 downto 0) ;<br />
      add_incr , io_mode  : in std_logic ;<br />
      add_iod , add_staged , add_fftd : out std_logic ;<br />
      butterfly_iod : out std_logic_vector(3 downto 0) ) ;<br />
end iod_staged ;<br />
<br />
architecture rtl of iod_staged is<br />
begin<br />
process(but_fly,add_incr,io_mode)<br />
begin<br />
if(but_fly = 15 and io_mode = '1' and add_incr='0') then<br />
add_iod &lt;= '1' ; -- io done signal<br />
butterfly_iod &lt;= but_fly ;<br />
elsif(but_fly = 4 and io_mode = '0' and add_incr='1') then<br />
butterfly_iod &lt;= but_fly ;<br />
add_iod &lt;= '0' ;<br />
add_staged &lt;= '1' ; -- stage done signal<br />
else<br />
butterfly_iod &lt;= but_fly ;<br />
add_staged &lt;= '0' ;<br />
end if ;<br />
end process ;<br />
<br />
process(stage_no)<br />
begin<br />
if (stage_no=3) then<br />
add_fftd &lt;= '1' ; -- fft done signal<br />
end if ;<br />
end process ;<br />
<br />
end rtl;<br />
-- POSITIVE LEVEL TRIGGERED FLIP FLOPS<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity l_block is <br />
 port (<br />
       data_l : in std_logic_vector(31 downto 0) ;<br />
       trigger_l : in std_logic ;<br />
       l_out : out std_logic_vector(31 downto 0) ) ;<br />
end l_block ;<br />
<br />
architecture rtl of l_block is<br />
begin<br />
process(data_l , trigger_l)<br />
begin<br />
if (trigger_l='1') then<br />
l_out &lt;= data_l ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- MULTIPLEXER TO CHOOSE BETWEEN CLOCK AND C0<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity mult_clock is<br />
port (<br />
      clock_main , mult1_c0 , mult1_iomode , mult_clear : in std_logic ;<br />
      mult1_addincr : out std_logic ) ;<br />
end mult_clock ;<br />
<br />
architecture rtl of mult_clock is<br />
begin<br />
process(clock_main , mult1_c0 , mult1_iomode , mult_clear) <br />
variable temp1 : std_logic ;<br />
variable temp2 : std_logic ;<br />
begin<br />
if(mult1_iomode = '0') then -- ie, fft computation mode<br />
temp2 := mult1_c0 ; <br />
elsif(mult1_iomode = '1') then -- ie, io mode<br />
temp1 := clock_main ;<br />
end if ;<br />
if (mult1_iomode = '1') then<br />
mult1_addincr &lt;= temp1 ;<br />
elsif(mult1_iomode = '0') then<br />
mult1_addincr &lt;= temp2 ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- MULTIPLY UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity multiply is<br />
 port(<br />
      num_mux , num_rom : in std_logic_vector(31 downto 0) ;<br />
      clock : in std_logic ;<br />
      mult_out : out std_logic_vector(31 downto 0) ) ;<br />
end multiply ;<br />
<br />
architecture rtl of multiply is<br />
begin<br />
process(num_mux , num_rom , clock)<br />
variable sign_mult , t : std_logic := '0' ;<br />
variable temp1 , temp2 : std_logic_vector(22 downto 0) ;<br />
variable exp_mux , exp_rom : std_logic_vector(7 downto 0) ;<br />
variable mant_temp : std_logic_vector(45 downto 0) ;<br />
variable exp_mult , mux_temp , rom_temp : std_logic_vector(8 downto 0) ;<br />
variable res_temp : std_logic_vector(31 downto 0) ;<br />
begin<br />
<br />
temp1 := '1' &amp; num_mux(22 downto 1) ; -- '1' for implicit '1'. <br />
temp2 := '1' &amp; num_rom(22 downto 1) ;<br />
if (num_mux(31) = '1' and num_rom(31) = '1' and clock = '1') then -- sign of results<br />
sign_mult := '0' ;<br />
elsif (num_mux(31) = '0' and num_rom(31) = '0' and clock = '1') then<br />
sign_mult := '0' ;<br />
elsif(clock = '1') then<br />
sign_mult := '1' ;<br />
end if ;<br />
<br />
if (num_mux = 0 and clock = '1') then -- ie, the number is zero.<br />
t := '1' ;<br />
elsif (num_rom = 0 and clock = '1') then<br />
t := '1' ;<br />
elsif (clock = '1') then<br />
t := '0' ;<br />
end if ;<br />
<br />
if (t = '0' and clock = '1') then -- separation of mantissa and exponent <br />
exp_mux := num_mux (30 downto 23) ;<br />
exp_rom := num_rom (30 downto 23) ;<br />
mux_temp := '0' &amp; exp_mux(7 downto 0) ;<br />
rom_temp := '0' &amp; exp_rom(7 downto 0) ;<br />
exp_mult := mux_temp + rom_temp ;<br />
exp_mult := exp_mult - 127 ;<br />
<br />
mant_temp := temp1 * temp2 ;<br />
<br />
if(mant_temp(45) = '1') then -- normalisation.<br />
exp_mult := exp_mult + 1 ;<br />
res_temp := sign_mult &amp; exp_mult(7 downto 0) &amp; mant_temp(44 downto 22) ;<br />
mult_out &lt;= res_temp(31 downto 0) ;<br />
elsif(mant_temp(45) = '0') then<br />
res_temp := sign_mult &amp; exp_mult(7 downto 0) &amp; mant_temp(43 downto 21) ;<br />
mult_out &lt;= res_temp(31 downto 0) ;<br />
end if ;<br />
elsif (t = '1' and clock = '1') then -- number zero<br />
mult_out &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
t := '0' ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- multiplexer in the address generation unit<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity mux_add is<br />
port (<br />
      a , b : in std_logic_vector(3 downto 0) ;<br />
      sel : in std_logic ;<br />
      q : out std_logic_vector(3 downto 0) ) ;<br />
end mux_add ;<br />
<br />
architecture rtl of mux_add is<br />
begin<br />
process (a , b , sel)<br />
begin<br />
if(sel = '0') then<br />
q &lt;= a(3 downto 0) after 2 ns ;<br />
elsif(sel = '1') then<br />
q &lt;= b(3 downto 0) after 2 ns ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- MULTIPLEXER IN THE BUTTERFLY PROCESSING UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity mux is<br />
 port (<br />
       d0 , d1 : in std_logic_vector(31 downto 0) ;<br />
       mux_out : out std_logic_vector(31 downto 0) ;<br />
       choose : in std_logic ) ;<br />
end mux ;<br />
 <br />
architecture rtl of mux is<br />
begin<br />
process(d0 , d1 , choose)<br />
begin<br />
if (choose = '0') then<br />
mux_out &lt;= d0(31 downto 0) ;<br />
elsif (choose = '1') then<br />
mux_out &lt;= d1(31 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
--NEGATION UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity negate is<br />
 port (<br />
       neg_in : in std_logic_vector(31 downto 0) ;<br />
       neg_en , clock_main : in std_logic ;<br />
       neg_out : out std_logic_vector(31 downto 0) ) ;<br />
end negate ;<br />
<br />
architecture rtl of negate is<br />
begin<br />
process(neg_in , neg_en , clock_main) <br />
variable neg_temp : std_logic_vector(31 downto 0) ;<br />
begin<br />
neg_temp := neg_in(31 downto 0) ;<br />
if (clock_main = '1') then<br />
if (neg_en = '1') then<br />
if(neg_in(31) = '0') then<br />
neg_temp := '1' &amp; neg_temp (30 downto 0) ;<br />
else<br />
neg_temp := '0' &amp; neg_temp (30 downto 0) ;<br />
end if ;<br />
neg_out &lt;= neg_temp ;<br />
else<br />
neg_out &lt;= neg_in(31 downto 0) ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
--while not endfile(vector_file) loop<br />
--for count in 1 to 16 loop<br />
-- Behavioral description of dual-port SRAM with :<br />
-- Active High write enable (WE)<br />
-- Active High read enable (RE)<br />
-- Rising clock edge (Clock)<br />
library ieee;<br />
use ieee.std_logic_1164.all;<br />
use IEEE.std_logic_arith.all;<br />
use IEEE.std_logic_unsigned.all;<br />
use work.butter_lib.all ;<br />
entity reg_dpram is<br />
port (<br />
      data_fft , data_io : in std_logic_vector (31 downto 0);<br />
      q : out std_logic_vector (31 downto 0);<br />
      clock , io_mode : in std_logic;<br />
      we , re : in std_logic;<br />
      waddress: in std_logic_vector (3 downto 0);<br />
      raddress: in std_logic_vector (3 downto 0));<br />
end reg_dpram;<br />
architecture behav of reg_dpram is<br />
type MEM is array (0 to 15) of std_logic_vector(31 downto 0);<br />
signal ramTmp : MEM;<br />
<br />
begin<br />
<br />
-- Write Functional Section<br />
process (clock,waddress,we)<br />
begin<br />
if (clock='0') then<br />
if (we = '1') then<br />
if (io_mode = '0') then<br />
ramTmp (conv_integer (waddress)) &lt;= data_fft ;<br />
elsif (io_mode = '1') then<br />
ramTmp (conv_integer (waddress)) &lt;= data_io ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
<br />
-- Read Functional Section<br />
process (clock,raddress,re)<br />
begin<br />
if (clock='1') then<br />
if (re = '1') then<br />
q &lt;= ramTmp(conv_integer (raddress)) ;<br />
end if;<br />
end if;<br />
end process;<br />
end behav;<br />
-- PARALLE IN PARALLEL OUT SHIFTER IN THE ADDRESS GENERATION UNIT.<br />
-- REQUIRED BECAUSE FFT IS COMPUTED ON DATA AND WRITTEN BACK INTO THE SAME<br />
-- LOCATION AFTER 5 CYCLES. SO THE READ ADDRESS IS SHIFTED THROUGH 5 CYCLES<br />
-- AND GIVEN AS WRITE ADDRESS.<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity ram_shift is<br />
port (<br />
      data_in : in std_logic_vector(3 downto 0) ;<br />
      clock_main : in std_logic ;<br />
      data_out : out std_logic_vector(3 downto 0) ) ;<br />
end ram_shift ;<br />
<br />
architecture rtl of ram_shift is<br />
begin<br />
process(clock_main , data_in)<br />
begin<br />
if (clock_main'event and clock_main = '0') then<br />
data_out &lt;= data_in(3 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- NEGATIVE EDGE TRIGGERED FLIP FLOPS<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity r_block is <br />
 port (<br />
       data : in std_logic_vector(31 downto 0) ;<br />
       trigger : in std_logic ;<br />
       r_out : out std_logic_vector(31 downto 0) ) ;<br />
end r_block ;<br />
<br />
architecture rtl of r_block is<br />
begin<br />
process(data , trigger)<br />
begin<br />
if (trigger='0' and trigger'event) then<br />
r_out &lt;= data(31 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- ROM TO STORE SINE AND COSINE VALUES<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity rom is<br />
port (<br />
      clock , en_rom : in std_logic ;<br />
      romadd : in std_logic_vector(2 downto 0) ;<br />
      rom_data : out std_logic_vector(31 downto 0) ) ;<br />
end rom ;<br />
<br />
architecture rtl of rom is<br />
begin <br />
process(clock,en_rom)<br />
begin<br />
if(en_rom = '1') then<br />
if(clock = '1') then<br />
case romadd is<br />
 when &quot;000&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111100000000000000000000000&quot; ;<br />
 when &quot;001&quot; =&gt;<br />
 rom_data &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
 when &quot;010&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111001101010000010010000001&quot; ;<br />
 when &quot;011&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111001101010000010010000001&quot; ;<br />
 when &quot;100&quot; =&gt;<br />
 rom_data &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
 when &quot;101&quot; =&gt;<br />
 rom_data &lt;=  &quot;00111111100000000000000000000000&quot; ;<br />
 when &quot;110&quot; =&gt;<br />
 rom_data &lt;= &quot;10111111001101010000010010000001&quot;  ;<br />
 when &quot;111&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111001101010000010010000001&quot; ;<br />
 when others =&gt; <br />
 rom_data &lt;= &quot;01000000000000000000000000000000&quot; ;<br />
end case ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- ADDRESS GENERATOR FOR ROM<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity romadd_gen is<br />
port (<br />
      io_rom,c0,c1,c2,c3 : in std_logic ;<br />
      stage_rom : in std_logic_vector(1 downto 0) ;<br />
      butterfly_rom : in std_logic_vector(3 downto 0) ;<br />
      romadd : out std_logic_vector(2 downto 0) ;<br />
      romgen_en : in std_logic );<br />
end romadd_gen ;<br />
<br />
architecture rtl of romadd_gen is<br />
begin <br />
process(io_rom,c0,c1,c2,c3,stage_rom,butterfly_rom)<br />
begin<br />
if(romgen_en = '1') then<br />
if(io_rom = '0') then<br />
 case stage_rom is<br />
<br />
 when &quot;00&quot; =&gt;<br />
 if(c0='1' or c2='1') then<br />
 romadd &lt;= &quot;000&quot; ;<br />
 elsif(c1='1' or c3='1') then<br />
 romadd &lt;= &quot;001&quot; ;<br />
 end if ;<br />
<br />
 when &quot;01&quot; =&gt;<br />
 if(butterfly_rom=0 or butterfly_rom=1) then<br />
  if(c0='1' or c2='1') then<br />
  romadd &lt;= &quot;000&quot; ;<br />
  elsif(c1='1' or c3='1') then<br />
  romadd &lt;= &quot;001&quot; ;<br />
  end if ;<br />
 elsif(butterfly_rom=2 or butterfly_rom=3) then<br />
  if(c0='1' or c2='1') then<br />
  romadd &lt;= &quot;100&quot; ;<br />
  elsif(c1='1' or c3='1') then<br />
  romadd &lt;= &quot;101&quot; ;<br />
  end if ;<br />
 end if ;<br />
<br />
 when &quot;10&quot; =&gt;<br />
  if(butterfly_rom=0) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;000&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;001&quot; ;<br />
   end if ;<br />
  elsif(butterfly_rom=1) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;100&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;101&quot; ;<br />
   end if ;<br />
  elsif(butterfly_rom=2) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;010&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;011&quot; ;<br />
   end if ;<br />
  elsif (butterfly_rom=3) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;110&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;111&quot; ;<br />
   end if ;<br />
  end if ;<br />
<br />
 when others =&gt;<br />
  romadd &lt;= &quot;000&quot; ;<br />
<br />
 end case ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- SHIFT UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_arith.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity shift2 is<br />
port (<br />
       sub_control : in std_logic_vector (8 downto 0) ;	<br />
       c_in  : in std_logic_vector (32 downto 0) ;<br />
       shift_out : out std_logic_vector (31 downto 0) ;<br />
       clock , shift_en , rst_shift : in std_logic ;<br />
       finish_out : out std_logic ) ;<br />
end shift2 ;<br />
architecture rtl of shift2 is<br />
begin<br />
process(clock)<br />
variable sub_temp : std_logic_vector(7 downto 0) ;<br />
variable  temp2 , temp4 : std_logic_vector(31 downto 0) ;<br />
variable temp3 , t : std_logic ;<br />
begin<br />
if(rst_shift='0') then<br />
if(shift_en = '1') then<br />
if(temp3 = '1') then<br />
if(sub_control(8) = '1') then <br />
sub_temp := sub_control (7 downto 0) ;<br />
temp2 := '1' &amp; c_in (31 downto 1) ; --'1' for implicit one<br />
temp3 := '0' ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
<br />
if(rst_shift='0') then<br />
if(shift_en = '1') then<br />
if(t = '1') then<br />
if (sub_control(8) = '1') then<br />
if (conv_integer(sub_temp(7 downto 0)) = 0) then<br />
shift_out &lt;= temp2 ;<br />
finish_out &lt;= '1' ;<br />
t := '0' ;<br />
elsif ( clock = '1') then<br />
temp2 := '0' &amp; temp2 (31 downto 1) ;<br />
sub_temp := sub_temp - &quot;00000001&quot; ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
elsif(rst_shift='1') then<br />
temp3 := '1' ;<br />
finish_out &lt;= '0' ;<br />
t := '1' ;<br />
end if ;<br />
<br />
end process ;<br />
end rtl ;<br />
-- SUBTRACTOR UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity subtractor is<br />
 port ( <br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock , rst_sub , sub_en : in std_logic ;<br />
       a_smaller , fin_sub , num_zero : out std_logic ;<br />
       zero_detect : out std_logic_vector(1 downto 0) ;<br />
       sub : out std_logic_vector (8 downto 0) ;<br />
       change : out std_logic ) ;<br />
end subtractor ;<br />
<br />
architecture rtl of subtractor is<br />
begin<br />
process (a , b , clock , rst_sub , sub_en)<br />
variable temp ,c , d : std_logic_vector (7 downto 0) ;<br />
variable e , f : std_logic_vector (22 downto 0) ;<br />
begin<br />
if (rst_sub = '0') then<br />
c := a (30 downto 23) ;<br />
d := b (30 downto 23) ;<br />
e := a (22 downto 0) ;<br />
f := b (22 downto 0) ;<br />
<br />
if(sub_en = '1') then<br />
if (clock = '1') then<br />
if ((c=0)) then<br />
zero_detect &lt;= &quot;01&quot; ;<br />
num_zero &lt;= '1' ;<br />
<br />
elsif ((d=0)) then<br />
zero_detect &lt;= &quot;10&quot; ;<br />
num_zero &lt;= '1' ;<br />
<br />
elsif (c &lt; d ) then<br />
temp := d - c ;<br />
a_smaller &lt;= '1' ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
elsif (d &lt; c) then<br />
temp := c - d ; <br />
a_smaller &lt;= '0' ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
elsif((c=d) and e &lt; f) then<br />
a_smaller &lt;= '1' ;<br />
temp:= c-d ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
elsif ((c=d) and e &gt; f) then <br />
a_smaller &lt;= '0' ;<br />
temp := c-d ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
fin_sub &lt;= '1' ;<br />
<br />
elsif ((c=d) and (e = f)) then<br />
temp := c-d ;<br />
a_smaller &lt;= '0' ;<br />
sub &lt;= '1' &amp; &quot;00000000&quot; ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
<br />
end if ;<br />
end if ;<br />
end if ;<br />
<br />
elsif(rst_sub = '1') then<br />
fin_sub &lt;= '0' ;<br />
sub &lt;= &quot;000000000&quot; ;<br />
num_zero &lt;= '0' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
<br />
end if ;<br />
<br />
end process ;<br />
<br />
process(a , b) -- process to identify when a new number comes<br />
begin<br />
change &lt;= transport '1' after 1 ns ;<br />
change &lt;= transport '0' after 5 ns ;<br />
end process ;<br />
<br />
end rtl ;<br />
-- SUMMER<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity summer is<br />
port ( <br />
       num1 , num2 : in std_logic_vector (31 downto 0) ;<br />
       exp : in std_logic_vector (7 downto 0) ;<br />
       addpulse_in , addsub , rst_sum : in std_logic ;<br />
       add_finish : out std_logic ;<br />
       sumout : out std_logic_vector ( 32 downto 0) ) ;<br />
end summer ;<br />
architecture rtl of summer is<br />
begin<br />
process (num1 , num2 , addpulse_in , rst_sum)<br />
variable temp_num1 , temp_sum , temp_num2 , temp_sum2 , res : std_logic_vector (32 downto 0);<br />
variable temp_exp : std_logic_vector (7 downto 0) ;<br />
begin<br />
if (rst_sum = '0') then<br />
if (addpulse_in = '1') then<br />
temp_num1 := '0' &amp; num1 (31 downto 0) ; --0 to find whether normalisation is required.<br />
temp_num2 := '0' &amp; num2 (31 downto 0) ; --if required MSB will be 1 after addition<br />
<br />
if (addsub = '1') then<br />
temp_sum := temp_num1 + temp_num2 ;<br />
sumout &lt;= temp_sum ;<br />
add_finish &lt;= '1' ;<br />
<br />
else<br />
temp_sum := temp_num2 - temp_num1 ;<br />
--res := temp_sum + temp_num1 ;<br />
sumout &lt;= temp_sum ;<br />
add_finish &lt;= '1' ;<br />
end if ;<br />
end if ;<br />
<br />
elsif (rst_sum = '1') then<br />
add_finish &lt;= '0';<br />
end if ;<br />
end process ;<br />
<br />
end rtl ;<br />
-- SWAP UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity swap is<br />
port (<br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock : in std_logic ;<br />
       rst_swap , en_swap : in std_logic ;<br />
       finish_swap : out std_logic ;<br />
       d : out std_logic_vector (31 downto 0) ;<br />
       large_exp : out std_logic_vector (7 downto 0) ;<br />
       c  : out std_logic_vector (32 downto 0 ) ) ;<br />
end swap ;<br />
<br />
architecture rtl of swap is<br />
begin<br />
process (a , b , clock , rst_swap , en_swap)<br />
variable x , y : std_logic_vector (7 downto 0) ;<br />
variable p , q : std_logic_vector (22 downto 0) ;<br />
begin<br />
if(rst_swap = '1' ) then <br />
c &lt;= '0' &amp; a(22 downto 0) &amp; &quot;000000000&quot; ;<br />
finish_swap &lt;= '0' ;<br />
elsif(rst_swap = '0') then<br />
if(en_swap = '1') then<br />
x := a (30 downto 23) ;<br />
y := b (30 downto 23) ;<br />
p := a (22 downto 0) ;<br />
q := b (22 downto  0) ;<br />
if (clock = '1') then<br />
if (x &lt; y) then<br />
c &lt;= '1' &amp; a (22 downto 0) &amp; &quot;000000000&quot; ; -- '1' for checking<br />
d &lt;= '1' &amp; b (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit one <br />
large_exp &lt;= b (30 downto 23) ; <br />
finish_swap &lt;= '1' ;<br />
<br />
elsif (y &lt; x) then<br />
c &lt;= '1' &amp; b (22 downto 0) &amp; &quot;000000000&quot; ;<br />
d &lt;= '1' &amp; a (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit 1.<br />
large_exp &lt;= a (30 downto 23) ;<br />
finish_swap &lt;= '1' ;<br />
<br />
elsif ( (x=y) and (p &lt; q)) then<br />
c &lt;= '1' &amp; a (22 downto 0) &amp; &quot;000000000&quot; ; -- '1' for checking<br />
d &lt;= '1' &amp; b (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit one<br />
large_exp &lt;= b (30 downto 23) ; <br />
finish_swap &lt;= '1' ; <br />
<br />
else<br />
c &lt;= '1' &amp; b (22 downto 0) &amp; &quot;000000000&quot; ;<br />
d &lt;= '1' &amp; a (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit 1.<br />
large_exp &lt;= a (30 downto 23) ;<br />
finish_swap &lt;= '1' ;<br />
<br />
end if ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end process;<br />
end rtl;<br />
<br />
-- STAGE NUMBER GENERATOR.<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity stage_gen is<br />
port (<br />
      add_staged , add_clear : in std_logic ;<br />
      st_stage : out std_logic_vector(1 downto 0) ) ;  <br />
end stage_gen ;<br />
<br />
architecture rtl of stage_gen is<br />
<br />
variable s_count : std_logic_vector(1 downto 0) ;<br />
begin<br />
process(add_staged , add_clear)<br />
begin<br />
if (add_clear = '1') then<br />
st_stage &lt;= &quot;00&quot; ;<br />
s_count := &quot;00&quot; ;<br />
elsif(add_staged'event and add_staged= '1' ) then<br />
st_stage &lt;= s_count + 1 ;<br />
s_count := s_count + 1 ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
--WAVEFORM GENERATOR<br />
-- THE 4 BITS OF &quot;DATA_OUT&quot; ARE &quot;C0 C1 C2 C3&quot;<br />
library ieee ; <br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
<br />
entity cycles is <br />
port (<br />
      clock_main , preset , c0_en , cycles_clear : in std_logic ;<br />
      waves : out std_logic_vector(3 downto 0) ) ;<br />
end cycles ;<br />
architecture rtl of cycles is<br />
--type state_values is (st0 , st1 , st2 ,  st3) ;<br />
--signal pres_state1 , next_state1 : state_values ;<br />
shared variable data_out : std_logic_vector(3 downto 0)  ;<br />
begin<br />
process (clock_main , preset , c0_en,cycles_clear)<br />
variable t : std_logic ;<br />
begin<br />
if (c0_en = '1') then<br />
 if (preset = '1' and t='1')then<br />
 pres_state1 &lt;= st0 ;<br />
 t := '0' ;<br />
 elsif (clock_main'event and clock_main= '0') then<br />
 pres_state1 &lt;= next_state1 ;<br />
 end if ;<br />
end if ;<br />
if(cycles_clear = '1') then<br />
t := '1' ;<br />
end if ;<br />
end process ;<br />
<br />
process(pres_state1 , c0_en , clock_main)<br />
variable temp_clock : std_logic ;<br />
begin<br />
<br />
 case pres_state1 is<br />
  when st0 =&gt;<br />
   data_out := &quot;1000&quot; ; <br />
   next_state1 &lt;= st1 ;<br />
<br />
  when st1 =&gt;<br />
    data_out :=  &quot;0100&quot; ;<br />
    next_state1 &lt;= st2 ;<br />
 <br />
 when st2 =&gt;<br />
   data_out := &quot;0010&quot; ;<br />
   next_state1 &lt;= st3 ;<br />
<br />
 when st3 =&gt;<br />
   data_out := &quot;0001&quot; ;<br />
   next_state1 &lt;= st0 ;<br />
<br />
 when others =&gt;<br />
    next_state1 &lt;= st0 ;<br />
<br />
end case ;<br />
<br />
waves &lt;= data_out ;<br />
<br />
end process ;<br />
end rtl ;<br />
<br />
<br />
-- CONTROL UNIT OF THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity cont_gen is<br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end cont_gen ;<br />
<br />
architecture rtl of cont_gen is<br />
type state is (rst1,rst2,rst3,rst4,rst5,rst6,rst7) ;<br />
signal current_state , next_state : state ;<br />
shared variable counter , temp2 : std_logic_vector(1 downto 0) := &quot;00&quot; ;<br />
begin<br />
process (current_state ,con_staged , con_iod , con_fftd , con_clkcount , c0) <br />
<br />
begin<br />
case current_state is<br />
 when rst1 =&gt;<br />
 con_iomode &lt;= '1' ; -- set mode to io.<br />
 con_ip &lt;= '1' ; -- input mode<br />
 con_clear &lt;= '1' ; -- clear all blocks<br />
 con_enbw &lt;= '1' ; -- enable write to RAM<br />
 con_enbor &lt;= '0' ; -- disable read<br />
 c0_enable &lt;= '0' ; -- disable cycles unit<br />
 disable &lt;= '1' ; -- disable counter<br />
 next_state &lt;= rst2 ;<br />
<br />
 when rst2 =&gt;<br />
  con_clear &lt;= '0' ; -- bring clear signal back to zero<br />
  next_state &lt;=rst3 ;<br />
<br />
 when rst3 =&gt;<br />
  if(con_iod = '1') then<br />
   con_preset &lt;= '1' ; -- reset cycles <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   c0_enable &lt;= '1' ; -- enable cycles<br />
   con_iomode &lt;= '0' ; -- set io mode to '0'<br />
   con_fft &lt;= '1' ; -- fft mode<br />
   en_rom &lt;= '1' ; -- enable ROM<br />
   en_romgen &lt;= '1' ; -- enable ROM address generator<br />
   con_clear &lt;= '1' ; -- clear all blocks<br />
   con_enbw &lt;= '0' ; -- disable write to RAM<br />
   con_enbor &lt;= '1' ; -- enable read from ROM<br />
   disable &lt;= '0' ; -- enable  counter unit. <br />
   next_state &lt;= rst4 ;<br />
  else<br />
  next_state &lt;= rst3 ;<br />
  end if ;<br />
<br />
 when rst4 =&gt;<br />
  con_preset &lt;= '0' ; -- reset for cycles <br />
  reset_counter &lt;= '0' ; -- reset for counter<br />
  con_clear &lt;= '0' ; -- clear all signals<br />
  if (con_clkcount = 5) then -- check whether 4 or not<br />
   con_enbw &lt;= '1' ; -- enable write to ROM<br />
   disable &lt;= '1' ; -- disable counter <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   next_state &lt;= rst5 ;<br />
  else<br />
   next_state &lt;= rst4 ;<br />
  end if ;<br />
 <br />
 when rst5 =&gt;<br />
  <br />
  if (con_fftd = '1') then <br />
  disable &lt;= '0' ; -- enable counter<br />
  reset_counter &lt;= '0' ; <br />
  con_clear &lt;= '1' ; -- clear butterfly generator<br />
  con_fft &lt;= '0' ; -- disable fft address generator<br />
  if (con_clkcount = 4) then<br />
    disable &lt;= '1';<br />
    con_enbw &lt;= '0' ;<br />
    con_iomode &lt;= '1' ;<br />
    con_op &lt;= '1' ;<br />
    con_ip &lt;= '0' ;<br />
    next_state &lt;= rst6 ;<br />
    else<br />
   next_state &lt;= rst5 ;<br />
   end if ;<br />
  else<br />
  next_state &lt;= rst5 ; <br />
 end if ;<br />
 <br />
 when rst6 =&gt;<br />
  con_clear &lt;= '0' ;<br />
  next_state &lt;= rst7 ;<br />
<br />
 when rst7 =&gt;<br />
  if(con_iod = '1') then<br />
   con_clear &lt;= '1' ;<br />
   con_preset &lt;= '1' ;<br />
   con_enbor &lt;= '0';<br />
  else<br />
  next_state &lt;= rst7 ;<br />
  end if ;<br />
  <br />
 <br />
 when others =&gt;<br />
  next_state &lt;= rst1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock_main , con_init)<br />
begin<br />
if(con_init = '1') then<br />
current_state &lt;= rst1 ;<br />
elsif (clock_main'event and clock_main = '0') then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- CONTROL UNIT OF THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity cont_gen is<br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end cont_gen ;<br />
<br />
architecture rtl of cont_gen is<br />
type state is (rst1,rst2,rst3,rst4,rst5,rst6,rst7) ;<br />
signal current_state , next_state : state ;<br />
shared variable counter , temp2 : std_logic_vector(1 downto 0) := &quot;00&quot; ;<br />
begin<br />
process (current_state ,con_staged , con_iod , con_fftd , con_clkcount , c0) <br />
<br />
begin<br />
case current_state is<br />
 when rst1 =&gt;<br />
 con_iomode &lt;= '1' ; -- set mode to io.<br />
 con_ip &lt;= '1' ; -- input mode<br />
 con_clear &lt;= '1' ; -- clear all blocks<br />
 con_enbw &lt;= '1' ; -- enable write to RAM<br />
 con_enbor &lt;= '0' ; -- disable read<br />
 c0_enable &lt;= '0' ; -- disable cycles unit<br />
 disable &lt;= '1' ; -- disable counter<br />
 next_state &lt;= rst2 ;<br />
<br />
 when rst2 =&gt;<br />
  con_clear &lt;= '0' ; -- bring clear signal back to zero<br />
  next_state &lt;=rst3 ;<br />
<br />
 when rst3 =&gt;<br />
  if(con_iod = '1') then<br />
   con_preset &lt;= '1' ; -- reset cycles <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   c0_enable &lt;= '1' ; -- enable cycles<br />
   con_iomode &lt;= '0' ; -- set io mode to '0'<br />
   con_fft &lt;= '1' ; -- fft mode<br />
   en_rom &lt;= '1' ; -- enable ROM<br />
   en_romgen &lt;= '1' ; -- enable ROM address generator<br />
   con_clear &lt;= '1' ; -- clear all blocks<br />
   con_enbw &lt;= '0' ; -- disable write to RAM<br />
   con_enbor &lt;= '1' ; -- enable read from ROM<br />
   disable &lt;= '0' ; -- enable  counter unit. <br />
   next_state &lt;= rst4 ;<br />
  else<br />
  next_state &lt;= rst3 ;<br />
  end if ;<br />
<br />
 when rst4 =&gt;<br />
  con_preset &lt;= '0' ; -- reset for cycles <br />
  reset_counter &lt;= '0' ; -- reset for counter<br />
  con_clear &lt;= '0' ; -- clear all signals<br />
  if (con_clkcount = 5) then -- check whether 4 or not<br />
   con_enbw &lt;= '1' ; -- enable write to ROM<br />
   disable &lt;= '1' ; -- disable counter <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   next_state &lt;= rst5 ;<br />
  else<br />
   next_state &lt;= rst4 ;<br />
  end if ;<br />
 <br />
 when rst5 =&gt;<br />
  <br />
  if (con_fftd = '1') then <br />
  disable &lt;= '0' ; -- enable counter<br />
  reset_counter &lt;= '0' ; <br />
  con_clear &lt;= '1' ; -- clear butterfly generator<br />
  con_fft &lt;= '0' ; -- disable fft address generator<br />
  if (con_clkcount = 4) then<br />
    disable &lt;= '1';<br />
    con_enbw &lt;= '0' ;<br />
    con_iomode &lt;= '1' ;<br />
    con_op &lt;= '1' ;<br />
    con_ip &lt;= '0' ;<br />
    next_state &lt;= rst6 ;<br />
    else<br />
   next_state &lt;= rst5 ;<br />
   end if ;<br />
  else<br />
  next_state &lt;= rst5 ; <br />
 end if ;<br />
 <br />
 when rst6 =&gt;<br />
  con_clear &lt;= '0' ;<br />
  next_state &lt;= rst7 ;<br />
<br />
 when rst7 =&gt;<br />
  if(con_iod = '1') then<br />
   con_clear &lt;= '1' ;<br />
   con_preset &lt;= '1' ;<br />
   con_enbor &lt;= '0';<br />
  else<br />
  next_state &lt;= rst7 ;<br />
  end if ;<br />
  <br />
 <br />
 when others =&gt;<br />
  next_state &lt;= rst1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock_main , con_init)<br />
begin<br />
if(con_init = '1') then<br />
current_state &lt;= rst1 ;<br />
elsif (clock_main'event and clock_main = '0') then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- CONTROL UNIT OF THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity cont_gen is<br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end cont_gen ;<br />
<br />
architecture rtl of cont_gen is<br />
type state is (rst1,rst2,rst3,rst4,rst5,rst6,rst7) ;<br />
signal current_state , next_state : state ;<br />
shared variable counter , temp2 : std_logic_vector(1 downto 0) := &quot;00&quot; ;<br />
begin<br />
process (current_state ,con_staged , con_iod , con_fftd , con_clkcount , c0) <br />
<br />
begin<br />
case current_state is<br />
 when rst1 =&gt;<br />
 con_iomode &lt;= '1' ; -- set mode to io.<br />
 con_ip &lt;= '1' ; -- input mode<br />
 con_clear &lt;= '1' ; -- clear all blocks<br />
 con_enbw &lt;= '1' ; -- enable write to RAM<br />
 con_enbor &lt;= '0' ; -- disable read<br />
 c0_enable &lt;= '0' ; -- disable cycles unit<br />
 disable &lt;= '1' ; -- disable counter<br />
 next_state &lt;= rst2 ;<br />
<br />
 when rst2 =&gt;<br />
  con_clear &lt;= '0' ; -- bring clear signal back to zero<br />
  next_state &lt;=rst3 ;<br />
<br />
 when rst3 =&gt;<br />
  if(con_iod = '1') then<br />
   con_preset &lt;= '1' ; -- reset cycles <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   c0_enable &lt;= '1' ; -- enable cycles<br />
   con_iomode &lt;= '0' ; -- set io mode to '0'<br />
   con_fft &lt;= '1' ; -- fft mode<br />
   en_rom &lt;= '1' ; -- enable ROM<br />
   en_romgen &lt;= '1' ; -- enable ROM address generator<br />
   con_clear &lt;= '1' ; -- clear all blocks<br />
   con_enbw &lt;= '0' ; -- disable write to RAM<br />
   con_enbor &lt;= '1' ; -- enable read from ROM<br />
   disable &lt;= '0' ; -- enable  counter unit. <br />
   next_state &lt;= rst4 ;<br />
  else<br />
  next_state &lt;= rst3 ;<br />
  end if ;<br />
<br />
 when rst4 =&gt;<br />
  con_preset &lt;= '0' ; -- reset for cycles <br />
  reset_counter &lt;= '0' ; -- reset for counter<br />
  con_clear &lt;= '0' ; -- clear all signals<br />
  if (con_clkcount = 5) then -- check whether 4 or not<br />
   con_enbw &lt;= '1' ; -- enable write to ROM<br />
   disable &lt;= '1' ; -- disable counter <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   next_state &lt;= rst5 ;<br />
  else<br />
   next_state &lt;= rst4 ;<br />
  end if ;<br />
 <br />
 when rst5 =&gt;<br />
  <br />
  if (con_fftd = '1') then <br />
  disable &lt;= '0' ; -- enable counter<br />
  reset_counter &lt;= '0' ; <br />
  con_clear &lt;= '1' ; -- clear butterfly generator<br />
  con_fft &lt;= '0' ; -- disable fft address generator<br />
  if (con_clkcount = 4) then<br />
    disable &lt;= '1';<br />
    con_enbw &lt;= '0' ;<br />
    con_iomode &lt;= '1' ;<br />
    con_op &lt;= '1' ;<br />
    con_ip &lt;= '0' ;<br />
    next_state &lt;= rst6 ;<br />
    else<br />
   next_state &lt;= rst5 ;<br />
   end if ;<br />
  else<br />
  next_state &lt;= rst5 ; <br />
 end if ;<br />
 <br />
 when rst6 =&gt;<br />
  con_clear &lt;= '0' ;<br />
  next_state &lt;= rst7 ;<br />
<br />
 when rst7 =&gt;<br />
  if(con_iod = '1') then<br />
   con_clear &lt;= '1' ;<br />
   con_preset &lt;= '1' ;<br />
   con_enbor &lt;= '0';<br />
  else<br />
  next_state &lt;= rst7 ;<br />
  end if ;<br />
  <br />
 <br />
 when others =&gt;<br />
  next_state &lt;= rst1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock_main , con_init)<br />
begin<br />
if(con_init = '1') then<br />
current_state &lt;= rst1 ;<br />
elsif (clock_main'event and clock_main = '0') then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
<br />
<br />
-- OUTPUT RESULTS. SYNTHESISABLE<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity print_result is<br />
port (clock,op : in std_logic ;<br />
      fin_res : out std_logic_vector(31 downto 0) ;<br />
      result : in std_logic_vector(31 downto 0));<br />
end print_result ;<br />
<br />
architecture rtl of print_result is<br />
begin<br />
process(op,clock)<br />
variable count : integer := 1  ;<br />
begin <br />
if (op = '1') then<br />
if (count &lt; 17) then<br />
if(clock='0' and clock'event) then<br />
fin_res &lt;= result ;<br />
count := count + 1 ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
<br />
<br />
<br />
<br />
<br />
    <br />
    <br />
<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity synth_main is<br />
port (<br />
      data_io : in std_logic_vector(31 downto 0);<br />
      final_op : out std_logic_vector(31 downto 0) ;<br />
      clock_main,clock,enbl,reset,init : in std_logic) ;     <br />
end synth_main ;<br />
<br />
architecture rtl of synth_main is <br />
signal shft , waves : std_logic_vector(3 downto 0) ;<br />
<br />
component subtractor <br />
  port ( <br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock , rst_sub , sub_en : in std_logic ;<br />
       a_smaller , fin_sub , num_zero : out std_logic ;<br />
       zero_detect : out std_logic_vector(1 downto 0) ;<br />
       sub : out std_logic_vector (8 downto 0);<br />
       change : out std_logic ) ;<br />
end component ;<br />
<br />
component swap<br />
 port (<br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock : in std_logic ;<br />
       rst_swap , en_swap : in std_logic ;<br />
       finish_swap : out std_logic ;<br />
       d : out std_logic_vector (31 downto 0) ;<br />
       large_exp : out std_logic_vector (7 downto 0) ;<br />
       c  : out std_logic_vector (32 downto 0 ) ) ;<br />
end component ;<br />
<br />
 <br />
component shift2<br />
 port (<br />
       sub_control : in std_logic_vector (8 downto 0) ;	<br />
       c_in  : in std_logic_vector (32 downto 0) ;<br />
       shift_out : out std_logic_vector (31 downto 0) ;<br />
       clock , shift_en , rst_shift : in std_logic ;<br />
       finish_out : out std_logic ) ;<br />
end component ;<br />
<br />
component control_main<br />
 port ( <br />
       a_small , sign_a , sign_b : in std_logic ;<br />
       sign_out , add_sub , reset_all : out std_logic ;<br />
       en_sub , en_swap , en_shift , addpulse , normalise : out std_logic ;<br />
       fin_sub , fin_swap , finish_shift , add_finish , end_all : in std_logic ;<br />
       clock_main , clock , reset , enbl , zero_num , change : in std_logic ) ;<br />
end component ;<br />
<br />
component summer <br />
 port ( <br />
       num1 , num2 : in std_logic_vector (31 downto 0) ;<br />
       exp : in std_logic_vector (7 downto 0) ;<br />
       addpulse_in , addsub , rst_sum : in std_logic ;<br />
       add_finish : out std_logic ;<br />
       sumout : out std_logic_vector ( 32 downto 0) ) ;<br />
end component ;<br />
<br />
component normalize<br />
 port ( <br />
      a , b : in std_logic_vector (31 downto 0) ;<br />
      numb : in std_logic_vector (32 downto 0) ;<br />
      exp : in std_logic_vector (7 downto 0) ;<br />
      signbit , addsub , clock , en_norm , rst_norm  : in std_logic  ;<br />
      zero_detect : in std_logic_vector(1 downto 0) ;<br />
      exit_n : out std_logic ;<br />
      normal_sum : out std_logic_vector (31 downto 0) ) ;<br />
end component ;<br />
<br />
component but_gen<br />
port (<br />
      add_incr , add_clear , stagedone : in std_logic ;<br />
      but_butterfly : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component stage_gen <br />
port (<br />
      add_staged , add_clear : in std_logic ;<br />
      st_stage : out std_logic_vector(1 downto 0) ) ;  <br />
end component ;<br />
<br />
component iod_staged <br />
port (<br />
      but_fly : in std_logic_vector(3 downto 0) ;<br />
      stage_no : in std_logic_vector(1 downto 0) ;<br />
      add_incr , io_mode  : in std_logic ;<br />
      add_iod , add_staged , add_fftd : out std_logic ; <br />
      butterfly_iod : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component baseindex<br />
port (<br />
      ind_butterfly : in std_logic_vector(3 downto 0) ;<br />
      ind_stage : in std_logic_vector(1 downto 0) ;<br />
      add_fft : in std_logic ;<br />
      fftadd_rd : out std_logic_vector(3 downto 0) ;<br />
      c0 , c1 , c2 , c3 : in std_logic ) ; <br />
end component ;<br />
<br />
component ioadd_gen<br />
port (<br />
      io_butterfly : in std_logic_vector(3 downto 0) ;<br />
      add_iomode , add_ip , add_op : in std_logic ;<br />
      base_ioadd : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component mux_add <br />
port (<br />
      a , b : in std_logic_vector(3 downto 0) ;<br />
      sel : in std_logic ;<br />
      q : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component ram_shift<br />
port (<br />
      data_in : in std_logic_vector(3 downto 0) ;<br />
      clock_main : in std_logic ;<br />
      data_out : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component cycles<br />
port (<br />
      clock_main , preset , c0_en , cycles_clear : in std_logic ;<br />
      waves : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component counter <br />
port (<br />
      c : out std_logic_vector(2 downto 0) ;<br />
      disable , clock_main , reset : in std_logic) ;<br />
end component ;<br />
<br />
<br />
component mult_clock<br />
port (<br />
      clock_main , mult1_c0 , mult1_iomode , mult_clear : in std_logic ;<br />
      mult1_addincr : out std_logic ) ;<br />
end component ;<br />
<br />
component cont_gen <br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end component ;<br />
<br />
component and_gates <br />
port (<br />
      waves_and : in std_logic_vector(3 downto 0) ;<br />
      clock_main , c0_en : in std_logic ;<br />
      c0,c1,c2,c3 : out std_logic ;<br />
      c0_c1,c2_c3,c0_c2,c1_c3 : out std_logic ) ;<br />
end component ;<br />
<br />
component r_block<br />
port (<br />
       data : in std_logic_vector(31 downto 0) ;<br />
       trigger : in std_logic ;<br />
       r_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component l_block<br />
port (<br />
       data_l : in std_logic_vector(31 downto 0) ;<br />
       trigger_l : in std_logic ;<br />
       l_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component level_edge  <br />
 port (<br />
       data_edge : in std_logic_vector(31 downto 0) ;<br />
       trigger_edge : in std_logic ;<br />
       edge_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component mux <br />
port (<br />
       d0 , d1 : in std_logic_vector(31 downto 0) ;<br />
       mux_out : out std_logic_vector(31 downto 0) ;<br />
       choose : in std_logic ) ;<br />
end component ;<br />
<br />
component negate <br />
port (<br />
       neg_in : in std_logic_vector(31 downto 0) ;<br />
       neg_en , clock_main : in std_logic ;<br />
       neg_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component multiply<br />
port(<br />
      num_mux , num_rom : in std_logic_vector(31 downto 0) ;<br />
      clock  : in std_logic ;<br />
      mult_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component divide<br />
port (<br />
       data_in : in std_logic_vector(31 downto 0) ;<br />
       data_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component romadd_gen <br />
port (<br />
      io_rom,c0,c1,c2,c3 : in std_logic ;<br />
      stage_rom : in std_logic_vector(1 downto 0) ;<br />
      butterfly_rom : in std_logic_vector(3 downto 0) ;<br />
      romadd : out std_logic_vector(2 downto 0) ;<br />
      romgen_en : in std_logic );<br />
end component ;<br />
<br />
component reg_dpram <br />
port (<br />
      data_fft , data_io : in std_logic_vector (31 downto 0);<br />
      q : out std_logic_vector (31 downto 0);<br />
      clock , io_mode : in std_logic;<br />
      we , re : in std_logic;<br />
      waddress: in std_logic_vector (3 downto 0);<br />
      raddress: in std_logic_vector (3 downto 0));<br />
end component ;<br />
<br />
component rom <br />
port (<br />
      clock , en_rom : in std_logic ;<br />
      romadd : in std_logic_vector(2 downto 0) ;<br />
      rom_data : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component print_result <br />
port (clock,op : in std_logic ;<br />
      fin_res : out std_logic_vector(31 downto 0) ;<br />
      result : in std_logic_vector(31 downto 0));<br />
end component ;<br />
<br />
begin<br />
<br />
result : print_result port map (clock_main,op,final_op,ram_data) ;<br />
but : but_gen port map (incr , clear , staged ,butterfly_iod) ;<br />
stg : stage_gen port map (staged , clear , stage) ;<br />
iod_stgd : iod_staged port map(butterfly_iod,stage,incr,io_mode,iod,staged,fftd,butterfly) ; <br />
base : baseindex port map (butterfly , stage , fft_en , fftadd_rd , c0 , c1 , c2 , c3) ;<br />
ioadd : ioadd_gen port map (butterfly , io_mode , ip , op , io_add) ;<br />
ram_shift1 : ram_shift port map (fftadd_rd , clock_main , shift1) ;<br />
ram_shift2 : ram_shift port map (shift1 , clock_main , shft) ;<br />
ram_shift3 : ram_shift port map (shft , clock_main , shift3) ;<br />
ram_shift4 : ram_shift port map (shift3 , clock_main ,shift4) ;<br />
ram_shift5 : ram_shift port map (shift4 , clock_main , shift5) ;<br />
--ram_shift6 : ram_shift port map (shift5 , clock_main , shift6) ;<br />
multx1 : mux_add port map (shift5 , io_add , io_mode , ram_wr) ;<br />
multx2 : mux_add port map (fftadd_rd , io_add , io_mode , ram_rd) ;<br />
cyc : cycles port map (clock_main , preset , c0_en , cyc_clear , waves) ;<br />
gates : and_gates port map(waves,clock_main,c0_en,c0,c1,c2,c3,c0_c1,c2_c3,c0_c2,c1_c3) ;<br />
cnt : counter port map (clk_count , disable , clock_main , reset_count) ; <br />
mux_clock : mult_clock port map (clock_main , c0 , io_mode , clear , incr) ;<br />
control : cont_gen port map (staged , iod , fftd , init , ip , op , io_mode , fft_en ,<br />
enbw , enbor , c0_en , preset , clear , disable , c0 , clock_main ,rom_en,romgen_en,reset_count,clk_count) ;<br />
<br />
reg_ram : reg_dpram port map (out_data,data_io,ram_data,clock_main,io_mode,enbw,enbor,ram_wr,ram_rd) ;<br />
<br />
f1 : r_block port map (ram_data , c0 , d2) ;<br />
f2 : l_block port map (ram_data , c1 , d3) ;<br />
f3 : r_block port map (ram_data , c2 , d4) ;<br />
f4 : r_block port map (ram_data , c3 , d5) ;<br />
f5 : r_block port map (d8 , c1_c3 , d9) ;<br />
f6 : l_block port map (d8 , c0_c2 , d10) ;<br />
f7 : l_block port map (d12 , c3 , d13) ;<br />
f8 : l_block port map (d12 , c1 , d14) ;<br />
f9 : r_block port map (d17 , clock_main , d18) ;<br />
f10 : r_block port map (data_rom , clock_main , rom_ff) ;<br />
mux1 : mux port map (d2 , d3 , d6 , c2_c3) ;<br />
mux2 : mux port map (d4 , d5 , d7 , c1_c3) ;<br />
mux3 : mux port map (d13 , d14 , d15 , c1_c3) ;<br />
neg1 : negate port map (d10 , c0_c1 ,clock_main , d11) ;<br />
neg2 : negate port map (d15 , c0_c1 ,clock_main , d16) ;<br />
mult1 : multiply port map (d6 , rom_ff , clock_main , d8) ;<br />
div : divide port map (d18 , d19) ;<br />
f11 : level_edge port map (d19,clock_main,out_data) ;<br />
<br />
rom_add1 : romadd_gen port map (io_mode,c0,c1,c2,c3,stage,butterfly,rom_add,romgen_en) ;<br />
rom1 : rom port map (clock ,rom_en,rom_add,data_rom) ;<br />
<br />
b11 : subtractor port map ( d16 , d7 , clock , rstb , ensubb , a_smallb , finsubb , numzerob , zerodetectb , subb ,  changeb) ;<br />
b2 : swap port map ( a=&gt;d16 , b=&gt;d7 , clock=&gt;clock , rst_swap=&gt;rstb , en_swap=&gt;enswapb , finish_swap=&gt;finswapb , d=&gt;swap_num2b , large_exp=&gt;expb , c=&gt;swap_num1b ) ;<br />
b4 : shift2 port map (sub_control=&gt;subb , c_in=&gt;swap_num1b , shift_out=&gt;shift_outb , clock=&gt;clock , shift_en=&gt;enshiftb,<br />
rst_shift=&gt;rstb , finish_out=&gt;finshiftb ) ;<br />
b5 : control_main port map ( a_smallb , d16(31) , d7(31) , signbitb , addsubb , rstb , ensubb , <br />
enswapb , enshiftb , addpulseb , normaliseb , finsubb , finswapb , finshiftb ,finish_sumb , end_allb , <br />
clock_main , clock , reset , enbl , numzerob , changeb ) ;<br />
b6 : summer port map ( shift_outb , swap_num2b , expb , addpulseb , addsubb , rstb , finish_sumb , sum_outb ) ;<br />
b7 : normalize port map (d16 , d7 , sum_outb , expb , signbitb , addsubb , clock , normaliseb , rstb , zerodetectb , end_allb , d17) ;<br />
<br />
a1 : subtractor port map ( d9 ,  d11 , clock , rst , ensub , a_small , finsub , numzero , zerodetect , suba , changea) ;<br />
a2 : swap port map (d9 ,d11 ,clock ,rst ,enswap , finswap ,swap_num2 , exp , swap_num1 ) ;<br />
a4 : shift2 port map (suba ,swap_num1 ,shift_outa ,clock , enshift , rst , finshift ) ;<br />
a5 : control_main port map ( a_small , d9(31) , d11(31) , signbit , addsub , rst , ensub , <br />
enswap , enshift , addpulse , normalise , finsub , finswap , finshift ,finish_sum , end_all , <br />
clock_main , clock , reset , enbl , numzero , changea ) ;<br />
a6 : summer port map ( shift_outa , swap_num2 , exp , addpulse , addsub , rst , finish_sum , sum_out ) ;<br />
a7 : normalize port map (d9 , d11 , sum_out , exp , signbit , addsub , clock , normalise , rst , zerodetect , end_all , d12) ;<br />
<br />
end rtl ;</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>dash8shamir</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236766.html</guid>
		</item>
		<item>
			<title>Prolog Symbolic Calc</title>
			<link>http://www.daniweb.com/forums/thread235974.html</link>
			<pubDate>Wed, 04 Nov 2009 13:40:32 GMT</pubDate>
			<description><![CDATA[I'm trying to write a program in prolog to do symbolic calculus.  It's failing on several functions, of which I dont have the *exact* form of the input.  These are: 
 
Differentiation: Failed: [y_const, const_exp] 
 
Integration:     Failed: [multi_x, distributive, trig2, trig, const, simple_poly]...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to write a program in prolog to do symbolic calculus.  It's failing on several functions, of which I dont have the *exact* form of the input.  These are:<br />
<br />
Differentiation: Failed: [y_const, const_exp]<br />
<br />
Integration:     Failed: [multi_x, distributive, trig2, trig, const, simple_poly]<br />
<br />
Any help?<br />
 <pre style="margin:20px; line-height:13px">is_var(x).<br />
is_var(y).<br />
<br />
is_constant(a).<br />
is_constant(b).<br />
is_constant(c).<br />
is_constant(e).<br />
is_constant(pi).<br />
is_constant(X) :- number(X).<br />
<br />
d(X,X,1) :- !.<br />
d(Y,_,0) :- is_constant(Y),!.<br />
d(Y,_,0) :- is_var(Y),!. % up to this clause, X != Y<br />
<br />
% free_of(E,X) &lt;=&gt; expression E is free of X<br />
free_of(X,X) :- !,fail.<br />
free_of(Y,X) :- is_var(Y).<br />
free_of(E,_) :- is_constant(E).<br />
free_of(add(A,B),X) :- free_of(A,X), free_of(B,X).<br />
free_of(sub(A,B),X) :- free_of(A,X), free_of(B,X).<br />
free_of(mul(A,B),X) :- free_of(A,X), free_of(B,X).<br />
free_of(div(A,B),X) :- free_of(A,X), free_of(B,X).<br />
free_of(exp(A,B),X) :- free_of(A,X), free_of(B,X).<br />
free_of(ln(A),X) :- free_of(A,X).<br />
free_of(sin(A),X) :- free_of(A,X).<br />
free_of(cos(A),X) :- free_of(A,X).<br />
<br />
% canonicalize(E,X,R) &lt;=&gt; R is a canonical representation of E, mainly for terms of polynomials<br />
%&nbsp;  For the canonicalized expression, constants appear first, and powers of x are grouped together,<br />
%&nbsp;  making it appear as K*exp(X,M), where both K and M are free of X, note that K may be 1, and M may be 1 or 0<br />
<br />
% assuming two canonicalized expressions, combining them into one canonicalized expression<br />
canonicalize_combine(mul(mul(A,exp(X,M)),mul(B,exp(X,N))), X, mul(mul(A,B),exp(X,add(M,N)))) :- free_of(A,X), free_of(B,X).<br />
canonicalize_combine(div(mul(A,exp(X,M)),nul(B,exp(X,N))), X, mul(div(A,B),exp(X,sub(M,N)))) :- free_of(A,X), free_of(B,X).<br />
canonicalize(X,X,mul(1,exp(X,1))).<br />
canonicalize(K,X,mul(K,exp(X,0))) :- free_of(K,X).<br />
canonicalize(exp(X,M),X, mul(1,exp(X,M))) :- free_of(M,X),!.<br />
canonicalize(mul(U,V),X, R) :- canonicalize(U,X,A), canonicalize(V,X,B), canonicalize_combine(mul(A,B),X,R).<br />
canonicalize(div(U,V),X, R) :- canonicalize(U,X,A), canonicalize(V,X,B), canonicalize_combine(div(A,B),X,R).<br />
<br />
%%%%%%DIFFERENTIATION EQUATIONS%%%%%%%%%%%%<br />
d(add(U,V),X,R):-d(U,X,A),d(V,X,B),R=add(A,B).<br />
d(sub(U,V),X,R):-d(U,X,A),d(V,X,B),R=sub(A,B).<br />
d(mul(C,U),X,R):-atomic(C),C\=X,d(U,X,A),R=mul(C,A),!.<br />
d(mul(U,V),X,R):-d(U,X,A),d(V,X,B),R=add(mul(U,B),mul(V,A)).<br />
d(div(U,V),X,R):-d(U,X,A),d(V,X,B),R=div(sub(mul(A,V),mul(B,U)),exp(V,2)).<br />
d(exp(U,C),X,R):-atomic(C),C\=X,d(U,X,A),R=mul(C,mul(A,exp(U,sub(C,1)))).<br />
d(sin(W),X,R):-d(W,X,Z),R=mul(Z,cos(W)).<br />
d(ln(W),X,R):-d(W,X,Z),R=div(Z,W).<br />
d(cos(W),X,R):-d(W,X,Z),R=(mul(Z,-sin(W))).<br />
d(exp(C,X),X,R):-atomic(C),C=E,d(W,X,Z),R=C*exp(W).<br />
<br />
%%%%%%INTEGRATION EQUATIONS%%%%%%%%%%%%%%%%%%%%%%<br />
in(A,X,R):-atomic(A),free_of(A,X),R=mul(A,X).<br />
in(X,X,R):-R=div(exp(X,2),2).<br />
in(exp(X,A),X,R):-atomic(A),R=div(exp(X,add(A,1)),add(A,1)).<br />
in(div(C,X),X,R):-R=mul(C,ln(X)).<br />
in(exp(e,X),X,R):-R=exp(e,X).<br />
in(exp(A,X),X,R):-atomic(A),R=div(exp(A,X),ln(A)).<br />
in(ln(X),X,R):-R=sub(mul(X,ln(X)),X).<br />
in(sin(X),X,R):-R=(-cos(X)).<br />
in(cos(X),X,R):-R=sin(X).<br />
in(add(U,V),X,R):-in(U,X,A),in(V,X,B),R=add(A,B).<br />
in(mul(add(U,V),W),X,R):-in(U,X,A),in(V,X,B),R=add(mul(W,A),mul(W,B)).</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>Cy137</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235974.html</guid>
		</item>
		<item>
			<title>Tutorial or Reference for jacob?</title>
			<link>http://www.daniweb.com/forums/thread235806.html</link>
			<pubDate>Tue, 03 Nov 2009 16:25:43 GMT</pubDate>
			<description>Does anyone know of a good place to find documentation for jacob?</description>
			<content:encoded><![CDATA[<div>Does anyone know of a good place to find documentation for jacob?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>Douglas Mokry</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235806.html</guid>
		</item>
		<item>
			<title>MatLab, find area under experimental data plot</title>
			<link>http://www.daniweb.com/forums/thread234127.html</link>
			<pubDate>Wed, 28 Oct 2009 15:58:29 GMT</pubDate>
			<description><![CDATA[Hi matlab experts, 
 
I didn't think daniweb has a matlab forum so I went over to another math forum to ask for matlab help. but i think it's either I am too stupid for the mathematicians or they are too smart to realize that it is NOT obvious what i should do from just function and math theory...]]></description>
			<content:encoded><![CDATA[<div>Hi matlab experts,<br />
<br />
I didn't think daniweb has a matlab forum so I went over to another math forum to ask for matlab help. but i think it's either I am too stupid for the mathematicians or they are too smart to realize that it is NOT obvious what i should do from just function and math theory names thrown at me... conclusion: daniweb explains the best =)<br />
<br />
now, since there is no official matlab forum here, I hope I can just try my luck.<br />
<br />
Question:<br />
I have some experimental data points plotted y against t where t = 0 to 30, 0.5 interval. I want to find area under graph from, say, t = 0.832 to 5.672<br />
<br />
How can I do it in matlab? Please show exact step by step as far as possible, because I am a matlab noob.<br />
<br />
So far I have seen example from trapz and quads, but the also require the function f(t) to be known, which is not possible in my case because mine is experimental data.<br />
<br />
I expect it to be something like this (psuedocode)<br />
 <pre style="margin:20px; line-height:13px">f = plot(t, y)<br />
A = integrate(f, t1, t2)</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>jakesee</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread234127.html</guid>
		</item>
		<item>
			<title>matlab problem, help me experts plz</title>
			<link>http://www.daniweb.com/forums/thread233966.html</link>
			<pubDate>Tue, 27 Oct 2009 20:59:58 GMT</pubDate>
			<description>Hello everyone  
 
i v just joined the forum and i would like u to give me some sort of help in my induction motor project  
i am using matlab to carry out the value for torque and then plot the torque Vs speed graph using matlab 
 
so torque should be calculated for different speeds and slips...</description>
			<content:encoded><![CDATA[<div>Hello everyone <br />
<br />
i v just joined the forum and i would like u to give me some sort of help in my induction motor project <br />
i am using matlab to carry out the value for torque and then plot the torque Vs speed graph using matlab<br />
<br />
so torque should be calculated for different speeds and slips<br />
(Not only different values of speed!)<br />
So<br />
given the following parameters<br />
<br />
R2=.8ohm<br />
Rt=1.2ohm<br />
Lt=2.2ohm<br />
L2=3 ohm<br />
v=225v<br />
s = (ws-wr) / ws , where ws=synchronous speed and wr=rotor speed<br />
i2= as in attachment<br />
<br />
torque=(3./wr)*(I2^2)*(R2/s)*(1-s)<br />
<br />
Also current cannot be one constant value<br />
It should be calculated accordingly to slip values, so for each slip value we should have a value for current<br />
To sum up , I think that we should use for loop to carry out values of slip ,corresponding speed ,and corresponding current on a range of values to create the proper plot<br />
If the code is correct we must end up with the graph shown in the attachment<br />
I will be thankful if u would help me<br />
Many thanks</div>  <br /> <div style="padding:5px">    <fieldset class="fieldset"> <legend>Attached Images</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/jpg.gif" alt="File Type: jpg" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12334&amp;d=1256677185" target="_blank">a propper output1.jpg</a> (8.9 KB)</td> </tr><tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/jpg.gif" alt="File Type: jpg" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12335&amp;d=1256677191" target="_blank">a worked ex.jpg</a> (148.8 KB)</td> </tr> </table> </fieldset>   </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>aabbddlah</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread233966.html</guid>
		</item>
		<item>
			<title>Pseudocode to Program</title>
			<link>http://www.daniweb.com/forums/thread232812.html</link>
			<pubDate>Sat, 24 Oct 2009 05:12:28 GMT</pubDate>
			<description>I am in a Prrogramming with Algoritims class, I have struggling a bit.  We are working on a currency conversion table.  Here is the assignment: 
 
•	Generate a set of test inputs and expected results for the Currency Conversion program.  
 
Do I need to complete a program in order to know my test...</description>
			<content:encoded><![CDATA[<div>I am in a Prrogramming with Algoritims class, I have struggling a bit.  We are working on a currency conversion table.  Here is the assignment:<br />
<br />
•	Generate a set of test inputs and expected results for the Currency Conversion program. <br />
<br />
Do I need to complete a program in order to know my test results? I'm really not sure what I need to do next, can anyone help?<br />
<br />
Blackbetty76</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>blackbetty76</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232812.html</guid>
		</item>
		<item>
			<title>Help With Scheme Procedure</title>
			<link>http://www.daniweb.com/forums/thread232455.html</link>
			<pubDate>Thu, 22 Oct 2009 23:53:20 GMT</pubDate>
			<description>Hello, and thank you for taking the time to help me! I am working on a Scheme procedure right now, which is supposed to read in integers until 0 is entered, and display the minimum of the integers (0 included). I have a question about the procedure, which is below. Keep in mind, I have only written...</description>
			<content:encoded><![CDATA[<div>Hello, and thank you for taking the time to help me! I am working on a Scheme procedure right now, which is supposed to read in integers until 0 is entered, and display the minimum of the integers (0 included). I have a question about the procedure, which is below. Keep in mind, I have only written ONE Scheme procedure thus far, which displayed the minimum of two integers, so it was much easier. So here is my question:  <br />
<br />
In the header, what do I put for the conditions after lambda? How do I tell the procedure that it needs to read in ints until 0 is entered? <br />
<br />
Thank you for any help you can provide!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>vileoxidation</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232455.html</guid>
		</item>
		<item>
			<title>MATLAB.. with Access?!!</title>
			<link>http://www.daniweb.com/forums/thread232415.html</link>
			<pubDate>Thu, 22 Oct 2009 20:31:51 GMT</pubDate>
			<description><![CDATA[Hi all... 
 
well.. the thing is that me & my team are working on our graduating project 
 
we are using MATLAB.. and we need to use a database 
we've tried Access.. but it seems hard as we need to store images in the  database 
 
when we tried to retrieve the image in matlab, the only thing we saw...]]></description>
			<content:encoded><![CDATA[<div>Hi all...<br />
<br />
well.. the thing is that me &amp; my team are working on our graduating project<br />
<br />
we are using MATLAB.. and we need to use a database<br />
we've tried Access.. but it seems hard as we need to store images in the  database<br />
<br />
when we tried to retrieve the image in matlab, the only thing we saw was a bunch of numbers, which by my guess would be the pixels of the picture?<br />
<br />
any one has an idea of the best database system to use with matlab? and how to retrieve images from the database to the matlab workspace?<br />
<br />
thanx a lot ^_^</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>Fadiy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232415.html</guid>
		</item>
		<item>
			<title>please help me write this prog in lisp</title>
			<link>http://www.daniweb.com/forums/thread230859.html</link>
			<pubDate>Sat, 17 Oct 2009 03:24:56 GMT</pubDate>
			<description>a.	create a list that stores the courses that you are taking this semester where the courses are stored in sublists as (designator number) such as (csc 375) so that your list will look like this:  ((csc 375) (his 100) (cit 140) (csc 402) (eng 200)) and then create 3 other lists for fictitious CSC...</description>
			<content:encoded><![CDATA[<div>a.	create a list that stores the courses that you are taking this semester where the courses are stored in sublists as (designator number) such as (csc 375) so that your list will look like this:  ((csc 375) (his 100) (cit 140) (csc 402) (eng 200)) and then create 3 other lists for fictitious CSC and/or CIT majors.  All students except one should have at least one eng class.  They should all have at least 2 courses, no more than 7.<br />
b.	write the following functions*<br />
i.	given a course list and a designator, print all courses of that designator<br />
ii.	given a course list, print all upper level courses (3xx and 4xx courses)<br />
iii.	given a course list, count the number of courses that are either CSC or CIT and returns that number<br />
iv.	given a course list, determine whether a given schedule is “hard”, “easy” or “in between” where a “hard” schedule is one where the student is taking only upper level courses, or only CIT/CSC courses, an easy schedule is one where the student is taking only 100 or 200 level courses or is one with no CSC or CIT courses, and in between is everything else, your function should return how hard the schedule is<br />
c.	run the four functions on your 4 student course lists, use ’eng as the designator when you try out the function from 5.b.i.<br />
<br />
<br />
I am new to lisp so please help me...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>maddy1985</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread230859.html</guid>
		</item>
		<item>
			<title>Computer Networks question</title>
			<link>http://www.daniweb.com/forums/thread227149.html</link>
			<pubDate>Fri, 02 Oct 2009 04:35:28 GMT</pubDate>
			<description>Hi I am having trouble creating a pseudocode for this question, but I did give it a shot. I hope someone can help. This is the question.  
 
Consider the concurrent logical channels protocol. This protocol does not guarantee that messages are delivered in order. Modify the protocol to ensure that...</description>
			<content:encoded><![CDATA[<div>Hi I am having trouble creating a pseudocode for this question, but I did give it a shot. I hope someone can help. This is the question. <br />
<br />
Consider the concurrent logical channels protocol. This protocol does not guarantee that messages are delivered in order. Modify the protocol to ensure that this is the case. I suggest you always send messages in channel order (first over channel 0, then over channel 1, then over channel 2, etc up to n-1 and then back over to channel 0). Modify the receiver to deliver messages to the application also in channel order (first channel 0, then 1, etc.). Modify also the receiver to have one buffer space for each channel (in case messages arrive out of order)<br />
<br />
this is the original pseudocode: <br />
<br />
 <pre style="margin:20px; line-height:13px">process sender<br />
variables<br />
body : data from higher layer<br />
sb: bit of last frame sent<br />
ab: bit of last acknowledgment<br />
begin<br />
when sb = ab then<br />
body := message from higher layer<br />
sb := (sb+1) mod 2<br />
19<br />
send frame(sb, body) to receiver<br />
when receive ack(ab) then<br />
skip<br />
when timeout for last message sent then<br />
if sb ≠ ab then<br />
send frame(sb, body) to receiver<br />
end<br />
<br />
process receiver<br />
variables<br />
body : data to be delivered to higher layer<br />
nb: bit of next frame to deliver to app<br />
b: bit in frame just received<br />
begin<br />
when receive frame(b, body) then<br />
20<br />
send ack(b) to sender<br />
if b = nb then<br />
deliver body to higher layer<br />
nb := (nb + 1) mod 2</pre><br />
this is my psedocode:<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
process sender<br />
<br />
const&nbsp;  N : number of logical channels<br />
<br />
&nbsp;<br />
<br />
variables<br />
<br />
body :&nbsp; &nbsp;  array[0 .. N-1] of whatever<br />
<br />
sb:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  array[0 .. N-1] of 0 .. 1<br />
<br />
ab:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[0 .. N-1] of 0 .. 1<br />
<br />
b:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 .. 1 {bit in ack}<br />
<br />
n:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 .. N-1 {channel number in ack}<br />
<br />
&nbsp;<br />
<br />
begin<br />
<br />
&nbsp;  for any i, 0 ≤ i &lt; N, //i is the channel number<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when sb[n] = ab[n] then<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body[n+1] := message from higher layer&nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sb[i] := (sb[i] + 1) mod 2<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send frame(i, sb[n+1], body[n+1]) to receiver<br />
<br />
&nbsp;  when receive ack(n, b) then<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ab[n] := b<br />
<br />
&nbsp;  for any i, 0 ≤ i &lt; N,<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; when timeout for message sent in channel i then<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if sb[i] ≠ ab[i] then<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send frame(i, sb[i], body[i]) to receiver<br />
<br />
end<br />
<br />
&nbsp;<br />
<br />
process receiver<br />
<br />
const&nbsp; &nbsp; N:&nbsp; number of channels<br />
<br />
variables<br />
<br />
nb:&nbsp; &nbsp; array [0 .. N-1] of 0..1 {next bit expected}<br />
<br />
body:&nbsp; data to be delivered to higher layer<br />
<br />
b:&nbsp; &nbsp;  0..1&nbsp; {bit received in frame}<br />
<br />
n:&nbsp; &nbsp;  0 .. N-1 {channel number of frame}<br />
<br />
begin<br />
<br />
when receive frame(n, b, body) then<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if b = nb[n] then //if the received bit is the next bit expected then send ack<br />
<br />
send ack(n, b) to sender<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if b = nb[n] then<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; deliver body to higher layer<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nb[n] := (nb[n] + 1) mod 2</pre><br />
Can someone help?<br />
<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>imclumsy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread227149.html</guid>
		</item>
		<item>
			<title>Help with FORTRAN</title>
			<link>http://www.daniweb.com/forums/thread227107.html</link>
			<pubDate>Thu, 01 Oct 2009 21:34:29 GMT</pubDate>
			<description>Anyone here knows anything about FORTRAN. 
Planning on doing a research on FORTRAN. 
Help is really appreciated.</description>
			<content:encoded><![CDATA[<div>Anyone here knows anything about FORTRAN.<br />
Planning on doing a research on FORTRAN.<br />
Help is really appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>virtualmisc</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread227107.html</guid>
		</item>
		<item>
			<title>HEX dump</title>
			<link>http://www.daniweb.com/forums/thread226249.html</link>
			<pubDate>Mon, 28 Sep 2009 05:09:45 GMT</pubDate>
			<description>00000000  54 6d 6c 6a 5a 53 42 7a  64 47 46 79 64 43 34 67  |TmljZSBzdGFydC4g| 
00000010  49 46 4e 31 63 6d 55 67  61 47 39 77 5a 53 42 35  |IFN1cmUgaG9wZSB5| 
00000020  62 33 55 67 64 47 68 70  62 6d 73 67 61 58 51 67  |b3UgdGhpbmsgaXQg| 
00000030  64 32 46 7a 49 48 4e 30  64 58 42 70 5a 43 42 7a ...</description>
			<content:encoded><![CDATA[<div>00000000  54 6d 6c 6a 5a 53 42 7a  64 47 46 79 64 43 34 67  |TmljZSBzdGFydC4g|<br />
00000010  49 46 4e 31 63 6d 55 67  61 47 39 77 5a 53 42 35  |IFN1cmUgaG9wZSB5|<br />
00000020  62 33 55 67 64 47 68 70  62 6d 73 67 61 58 51 67  |b3UgdGhpbmsgaXQg|<br />
00000030  64 32 46 7a 49 48 4e 30  64 58 42 70 5a 43 42 7a  |d2FzIHN0dXBpZCBz|<br />
00000040  61 57 31 77 62 47 55 75  49 41 6f 4b 55 32 56 75  |aW1wbGUuIAoKU2Vu|<br />
00000050  5a 43 42 68 62 69 42 6c  4c 57 31 68 61 57 77 67  |ZCBhbiBlLW1haWwg|<br />
00000060  64 47 38 67 5a 6d 39 76  51 47 4e 6f 59 57 78 73  |dG8gZm9vQGNoYWxs|<br />
00000070  5a 57 35 6e 5a 53 34 77  65 44 51 78 4e 44 45 30  |ZW5nZS4weDQxNDE0|<br />
00000080  4d 54 51 78 4c 6d 4e 76  62 53 34 67 51 53 42 79  |MTQxLmNvbS4gQSBy|<br />
00000090  5a 58 42 73 65 53 42 33  61 57 78 73 49 47 4a 6c  |ZXBseSB3aWxsIGJl|<br />
000000a0  49 48 4e 6c 62 6e 51 67  64 47 38 67 64 47 68 6c  |IHNlbnQgdG8gdGhl|<br />
000000b0  49 48 4a 6c 63 47 78 35  4c 58 52 76 49 47 46 6b  |IHJlcGx5LXRvIGFk|<br />
000000c0  5a 48 4a 6c 63 33 4d 67  59 32 39 75 64 47 46 70  |ZHJlc3MgY29udGFp|<br />
000000d0  62 6d 6c 75 5a 79 42 30  61 47 55 67 56 56 4a 4d  |bmluZyB0aGUgVVJM|<br />
000000e0  49 47 39 6d 49 48 52 6f  5a 53 42 7a 5a 57 4e 76  |IG9mIHRoZSBzZWNv|<br />
000000f0  62 6d 51 67 64 47 46 7a  61 79 34 4b              |bmQgdGFzay4K|<br />
<br />
This is  dump I found and I was wondering what it said.<br />
If anyone could help me with this I would greatly appreciate it.<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>Dentkiller</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread226249.html</guid>
		</item>
		<item>
			<title>Re: permutation of a string</title>
			<link>http://www.daniweb.com/forums/thread225948.html</link>
			<pubDate>Sat, 26 Sep 2009 06:32:18 GMT</pubDate>
			<description><![CDATA[---Quote (Originally by varunrathi)--- 
Can anybody help me with permutation in c++. say if the entered string is "stop" then there must be 24 (=4*3*2*1) different words made by the letters s,t,o,p. Similarly if the entered string is "abcde" then there will be 120 (=5*4*3*2*1) different words made...]]></description>
			<content:encoded><![CDATA[<div><div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  <div> Originally Posted by <strong>varunrathi</strong> (Post 72258) </div> <div style="font-style:italic">Can anybody help me with permutation in c++. say if the entered string is &quot;stop&quot; then there must be 24 (=4*3*2*1) different words made by the letters s,t,o,p. Similarly if the entered string is &quot;abcde&quot; then there will be 120 (=5*4*3*2*1) different words made using the letters a,b,c,d,e.<br />
Please Help. It`s eating up my head.</div>  <hr /> </td> </tr> </table> </div><br />
<br />
Dear Varunrathi<br />
the problem you are asking to resolve is same as my problem.<br />
Your mind is eaten up and i m totally eaten up by this problem, I am also looking <br />
for some people who dared to solve this by programming. I work under ForTran, <br />
so if you have got your problem resolved, can you pass me the algorithm to do<br />
the permutation. my email id is SNIP<br />
please, for god sake<br />
Thank you</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>haroonjamia</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225948.html</guid>
		</item>
		<item>
			<title>plz plz help me in LABVIEW</title>
			<link>http://www.daniweb.com/forums/thread225620.html</link>
			<pubDate>Fri, 25 Sep 2009 06:42:12 GMT</pubDate>
			<description>hello to every one  
 
im making a GUI in labview and i want to take serial data in  labview im new in labview so plz help me  
 
thanks for replyng</description>
			<content:encoded><![CDATA[<div>hello to every one <br />
<br />
im making a GUI in labview and i want to take serial data in  labview im new in labview so plz help me <br />
<br />
thanks for replyng</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>adeelghani</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225620.html</guid>
		</item>
		<item>
			<title>need university help first year</title>
			<link>http://www.daniweb.com/forums/thread225604.html</link>
			<pubDate>Fri, 25 Sep 2009 05:32:06 GMT</pubDate>
			<description>hey this is umar here and i really needed some help because i have my exam tommorow. i was assigned to make a robot. ad to program it as some of may you know( i hope) the NXC language (i think its called that) to program the Mindstorms nxt brick. if some can help me i only have limited knowledge, i...</description>
			<content:encoded><![CDATA[<div>hey this is umar here and i really needed some help because i have my exam tommorow. i was assigned to make a robot. ad to program it as some of may you know( i hope) the NXC language (i think its called that) to program the Mindstorms nxt brick. if some can help me i only have limited knowledge, i need to make this robot stay away from this color yellow and stay in black , i will be given a a small rink or arean painted black (as big as a air hockey table) and rest painted yellow. there will also be another robot that will try to catch my robot so i have to make my robot escape for about 90 secs. i have written some code if some of you can help that would be great.[description of my robot: its both sensors are on the front( light sensor facing ab to the ground and the distance one facing straight forwarf) the two motors are on the front wheels and one tire on the back. and here is my code so far.<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &quot;NXCDefs.h&quot;<br />
<br />
mutex moveMutex;<br />
#define dist&nbsp; 60<br />
#define extranear&nbsp; 10<br />
int tries = 0;<br />
<br />
<br />
<br />
<br />
inline void scan_front()<br />
{<br />
&nbsp; <br />
&nbsp; SetSensorLowspeed(IN_1);<br />
&nbsp; <br />
<br />
<br />
<br />
if (SensorUS(IN_1) &gt; dist)<br />
{<br />
<br />
&nbsp; &nbsp; OnFwd(OUT_AB, 75);<br />
&nbsp; &nbsp; &nbsp; &nbsp; tries = 0;<br />
}&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
if (SensorUS(IN_1) &lt; dist){<br />
<br />
Off(OUT_AB);<br />
RotateMotor(OUT_A, 80, 300);<br />
tries++;<br />
<br />
<br />
}<br />
<br />
if(SensorUS(IN_1) &lt; extranear)<br />
<br />
{<br />
Off(OUT_AB);<br />
<br />
RotateMotor(OUT_A, 80, 720);<br />
<br />
<br />
}<br />
<br />
<br />
if(tries &gt;= 3 ){<br />
Off(OUT_AB);<br />
&nbsp;OnFwd(OUT_AB, 75);<br />
}<br />
<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
task main()<br />
{<br />
&nbsp;<br />
<br />
while (true){<br />
<br />
<br />
scan_front();<br />
<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
}</pre><br />
*Update: the tries thing i did doesnt seem to work.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>umarmaqsood</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225604.html</guid>
		</item>
		<item>
			<title>Error when using a contraint in Access</title>
			<link>http://www.daniweb.com/forums/thread224926.html</link>
			<pubDate>Tue, 22 Sep 2009 19:55:39 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I am trying to complete an example from the book SQL for Microsoft Access. I have typed it into Access just as it appears in the book. When I run it, however, I get an error message telling me that there is a "Syntax error in Constraint clause." I have checked and checked and I am fairly...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am trying to complete an example from the book SQL for Microsoft Access. I have typed it into Access just as it appears in the book. When I run it, however, I get an error message telling me that there is a &quot;Syntax error in Constraint clause.&quot; I have checked and checked and I am fairly certain that I typed it in right. Anyway, here is the code from the book.<br />
<br />
 <pre style="margin:20px; line-height:13px">CREATE TABLE Manufacturers<br />
(<br />
ManufacturerID INTEGER CONSTRAINT ManfID PRIMARY KEY,<br />
ToyID INTEGER NOT NULL,<br />
CompanyName CHAR (50) NOT NULL,<br />
Address CHAR (50) NOT NULL,<br />
City CHAR (20) NOT NULL,<br />
State CHAR (2) NOT NULL,<br />
AreaCode CHAR (3) NOT NULL,<br />
PhoneNumber CHAR (8) NOT NULL UNIQUE,<br />
CONSTRAINT ToyFk FOREIGN KEY (ToyID) REFERENCES Toys (ToyID) <br />
ON UPDATE CASCADE <br />
ON DELETE CASCADE<br />
);</pre><br />
Does Access 2007 support constraints? If so, then could you please offer a guess as to what the problem could be? Oh, and yes, I did previously create the Toys table, so it can't be generating an error because of that being missing.<br />
<br />
Ren</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>RenFromPenn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread224926.html</guid>
		</item>
		<item>
			<title>VFP help</title>
			<link>http://www.daniweb.com/forums/thread223509.html</link>
			<pubDate>Wed, 16 Sep 2009 14:18:37 GMT</pubDate>
			<description><![CDATA[hey all, i've asked this on a number of VFP sites and gotten many different answers- can anyone tell me how to include programming in VFP7 to strip Windows line breaks-  
hex: 
0D 0A  
which is Chr(13) and Char(10) which is a line break for Windows 
 
any help is greatly appreciated]]></description>
			<content:encoded><![CDATA[<div>hey all, i've asked this on a number of VFP sites and gotten many different answers- can anyone tell me how to include programming in VFP7 to strip Windows line breaks- <br />
hex:<br />
0D 0A <br />
which is Chr(13) and Char(10) which is a line break for Windows<br />
<br />
any help is greatly appreciated</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>NEGATIVEQUITY</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread223509.html</guid>
		</item>
		<item>
			<title>Automation of SAP transaction analysis</title>
			<link>http://www.daniweb.com/forums/thread223414.html</link>
			<pubDate>Wed, 16 Sep 2009 07:00:21 GMT</pubDate>
			<description>Hi everyone! 
My name is Max and I’ve been an ABAP programmer for 6 years now. Since my work is closely connected with SAP I have to face the very same annoying problem pretty often. The thing is, sometimes it is vital important to know the base data model and an internal structure of SAP...</description>
			<content:encoded><![CDATA[<div>Hi everyone!<br />
My name is Max and I’ve been an ABAP programmer for 6 years now. Since my work is closely connected with SAP I have to face the very same annoying problem pretty often. The thing is, sometimes it is vital important to know the base data model and an internal structure of SAP transactions which are typically very complex and are always developed in a messy manner. So even for a professional it is hard and so time-consuming to find lead essences act in transaction, its relations and key fields, enhancement and integration points etc. <br />
So I start wondering if there is any kind of program, utility or application that might automate the process, completely or partially, and finally lighten things up.<br />
Any ideas? Thanks in advance.<br />
Sincerely, Max.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>mainoffender</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread223414.html</guid>
		</item>
		<item>
			<title>Learning a language online</title>
			<link>http://www.daniweb.com/forums/thread223031.html</link>
			<pubDate>Mon, 14 Sep 2009 21:27:47 GMT</pubDate>
			<description>Learning a language online via skype or Messenger is the new tecnology, that provides you with all the knowledge and comfort of the XXI century. In the era of Iphone, laptop etc. even learning a language should be easy and less effortless.Share with me your opinions on the matter.</description>
			<content:encoded><![CDATA[<div>Learning a language online via skype or Messenger is the new tecnology, that provides you with all the knowledge and comfort of the XXI century. In the era of Iphone, laptop etc. even learning a language should be easy and less effortless.Share with me your opinions on the matter.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>insegnanteina</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread223031.html</guid>
		</item>
		<item>
			<title>i do really need your help guys... its about mobile application in netbeans</title>
			<link>http://www.daniweb.com/forums/thread221951.html</link>
			<pubDate>Thu, 10 Sep 2009 08:41:54 GMT</pubDate>
			<description>hi... i do really need your help guys... its about mobile application in netbeans IDE 6.7.1 
 
im a total newbie here... 
 
so, im asking for your help... 
 
so here it goes, i am planning to create a mobile application with the use of netbeans IDE 6.7.1, and the outcome would be like a call/text...</description>
			<content:encoded><![CDATA[<div>hi... i do really need your help guys... its about mobile application in netbeans IDE 6.7.1<br />
<br />
im a total newbie here...<br />
<br />
so, im asking for your help...<br />
<br />
so here it goes, i am planning to create a mobile application with the use of netbeans IDE 6.7.1, and the outcome would be like a call/text message blocker...<br />
<br />
what i want to happen is that when the mobile phone user enter a number on the application, it will automatically block any messages and/or calls from that number... please please please help me:(<br />
<br />
thanks alot:)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>xilamei</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221951.html</guid>
		</item>
		<item>
			<title>scheme help, new to it</title>
			<link>http://www.daniweb.com/forums/thread221913.html</link>
			<pubDate>Thu, 10 Sep 2009 05:11:44 GMT</pubDate>
			<description><![CDATA[hi all, trying to write a function nonlat? which returns true if the given list does not contain any atoms. so an empty list would be a nonlat and return true. 
 
the tests i'm supposed to use are: 
 
(nonlat? '(a b c)) 
(nonlat? '(a (b) (c))) 
(nonlat? '((a b) ((c)) (d))) 
(nonlat? '()) 
 
and the...]]></description>
			<content:encoded><![CDATA[<div>hi all, trying to write a function nonlat? which returns true if the given list does not contain any atoms. so an empty list would be a nonlat and return true.<br />
<br />
the tests i'm supposed to use are:<br />
<br />
(nonlat? '(a b c))<br />
(nonlat? '(a (b) (c)))<br />
(nonlat? '((a b) ((c)) (d)))<br />
(nonlat? '())<br />
<br />
and the results are supposed to be #f, #f, #t and #t<br />
<br />
i've managed to get this code but not sure how to get the third to turn out a #t instead of a #f. i've only gotten it down to this, pretty basic but a start<br />
<br />
(define nonlat?<br />
(lambda (list)<br />
(null? list)))<br />
<br />
second problem is to write a function member-cat? which returns true if the atom cat is a member of the given list, otherwise it returns false. it's also supposed to only take 1 argument which is the reason for the tests being like they are<br />
<br />
the tests for this function is:<br />
(member-cat? '())<br />
(member-cat? '(bird cat dog))<br />
(member-cat? '(hamster turtle))<br />
(member-cat? '(cat))<br />
<br />
and it should return #f, #t, #f, #t respectively. so far with the second function i've managed to get it to work for all but the second test, classmate says to use recursive call and hard code 'cat into it but not sure exactly how to do that<br />
<br />
(define member-cat?<br />
  (lambda (lat)<br />
    (cond<br />
      ((null? lat) #f)<br />
      (else (or (eq? 'cat (car lat)))))))</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>deltemis</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221913.html</guid>
		</item>
		<item>
			<title>GW Basic variables</title>
			<link>http://www.daniweb.com/forums/thread216129.html</link>
			<pubDate>Fri, 04 Sep 2009 03:17:58 GMT</pubDate>
			<description><![CDATA[I have a program in GW Basic to collect data, and it needs to be re-written as the data is increasing and would be best handled within a loop. 
 
I read in range of string data; "A", "B", .... within the loop.   I then need to input, from the keyboard, numerical data, say A1, A2, A3, A4 against...]]></description>
			<content:encoded><![CDATA[<div>I have a program in GW Basic to collect data, and it needs to be re-written as the data is increasing and would be best handled within a loop.<br />
<br />
I read in range of string data; &quot;A&quot;, &quot;B&quot;, .... within the loop.   I then need to input, from the keyboard, numerical data, say A1, A2, A3, A4 against each of these String variables.<br />
<br />
Q. How do I convert string &quot;A&quot; into numerical variables A1, A2, ...?   I cannot find anyway in GW Basic that allows this.<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>kanga85</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread216129.html</guid>
		</item>
		<item>
			<title>Foxpro application with timer</title>
			<link>http://www.daniweb.com/forums/thread215535.html</link>
			<pubDate>Tue, 01 Sep 2009 18:30:08 GMT</pubDate>
			<description>We are using foxpro application as a bridge between two systems.Well,at midnight the bridge seems to drop the connection and hence theres no communication betwen the two systems.The network link seems pretty fine.The other issue is that the bridge does not change the date at midnight.This seems to...</description>
			<content:encoded><![CDATA[<div>We are using foxpro application as a bridge between two systems.Well,at midnight the bridge seems to drop the connection and hence theres no communication betwen the two systems.The network link seems pretty fine.The other issue is that the bridge does not change the date at midnight.This seems to happen every day.Any ideas as to what happens?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>lasherz2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread215535.html</guid>
		</item>
		<item>
			<title>Good Language for Programming AI</title>
			<link>http://www.daniweb.com/forums/thread214997.html</link>
			<pubDate>Sun, 30 Aug 2009 11:11:17 GMT</pubDate>
			<description>Hello, 
 
I have an interest in AI and i would like to start learning a language thats really suited for AI.  
I must say i only have some basics in programming, which language would be best suited for me to start doing some AI?.  
And what are good tutorials to start with the language? 
 
h3llpunk</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have an interest in AI and i would like to start learning a language thats really suited for AI. <br />
I must say i only have some basics in programming, which language would be best suited for me to start doing some AI?. <br />
And what are good tutorials to start with the language?<br />
<br />
h3llpunk</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>h3llpunk</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread214997.html</guid>
		</item>
		<item>
			<title>Matlab problem</title>
			<link>http://www.daniweb.com/forums/thread213384.html</link>
			<pubDate>Sun, 23 Aug 2009 11:54:01 GMT</pubDate>
			<description><![CDATA[Hi all, 
I am mew in matlab and I have to read a text and then make a vector with the binary value of their chars. 
 
For example : 
text = 'pr' 
ascii = 1010000 
1110010 
 
I want to make a vector like that --> 
[1;0;1;0;0;0;0;1;1;1;0;0;1;0]]]></description>
			<content:encoded><![CDATA[<div>Hi all,<br />
I am mew in matlab and I have to read a text and then make a vector with the binary value of their chars.<br />
<br />
For example :<br />
text = 'pr'<br />
ascii = 1010000<br />
1110010<br />
<br />
I want to make a vector like that --&gt;<br />
[1;0;1;0;0;0;0;1;1;1;0;0;1;0]<br />
<br />
<br />
My code is <br />
<br />
 <pre style="margin:20px; line-height:13px">function bits_vector = textbin(text)<br />
<br />
text_ascii = uint8(text);<br />
num = length(text_ascii)<br />
<br />
bits_matrix = dec2bin(text_ascii,7)-'0';<br />
<br />
len_vector = num*8<br />
<br />
bits_vector = zeros(len_vector,1)<br />
<br />
for i=1:len_vector<br />
&nbsp; &nbsp; bits_vector(i:(i+7)) = bits_matrix(i,:)<br />
&nbsp; &nbsp; i=i+8;<br />
end</pre><br />
Any help ? Please<br />
<br />
Thank you</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>bufospro</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread213384.html</guid>
		</item>
		<item>
			<title>help create a 4 bit adder with one output using PLDs</title>
			<link>http://www.daniweb.com/forums/thread212344.html</link>
			<pubDate>Tue, 18 Aug 2009 16:59:49 GMT</pubDate>
			<description>Hello I am a beginner in programming using PLDs and am trying to figure out how I could get all the sums and carries of the 4 bit adder to be outputed onto one pin. 
 
One in ectual fact I am designing a PLD that can do both arithmetic and logical peration. and am stuck with this small problem.  
...</description>
			<content:encoded><![CDATA[<div>Hello I am a beginner in programming using PLDs and am trying to figure out how I could get all the sums and carries of the 4 bit adder to be outputed onto one pin.<br />
<br />
One in ectual fact I am designing a PLD that can do both arithmetic and logical peration. and am stuck with this small problem. <br />
<br />
Any input will be appreciated</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>STUDENT#101</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread212344.html</guid>
		</item>
		<item>
			<title>Adding text to a TV tuner</title>
			<link>http://www.daniweb.com/forums/thread212164.html</link>
			<pubDate>Mon, 17 Aug 2009 07:55:36 GMT</pubDate>
			<description><![CDATA[Hello Deniweb readers, 
 
May i ask if is it possible to put a text or a string message layer in a screen's tv tuner. 
 
I am thinking of putting a message alert lets say a network with n numbers of Television connected to a PC with tv tuner. My task is to pop a message lets say by scheduling or...]]></description>
			<content:encoded><![CDATA[<div>Hello Deniweb readers,<br />
<br />
May i ask if is it possible to put a text or a string message layer in a screen's tv tuner.<br />
<br />
I am thinking of putting a message alert lets say a network with n numbers of Television connected to a PC with tv tuner. My task is to pop a message lets say by scheduling or manually and then clears everything when I want to. The thing is I should be able to control the message to show and as well gracefull enough to clear the message.  The message may be in a transparent background with font, size ,color and coordinates customizable. It should also support gradient or opaque background within the text message.<br />
Also, it should be light weight enought not to congest the network for I will also want to put a clock at the lower right corner and a scrolling marquee text message on the bottom..<br />
<br />
Will this be possible? What would be the setup in C#.net?<br />
Please advise.<br />
<br />
Sincerely, <br />
Jan</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>janverge</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread212164.html</guid>
		</item>
		<item>
			<title>Sudoku Solver in Ruby</title>
			<link>http://www.daniweb.com/forums/thread211815.html</link>
			<pubDate>Sun, 16 Aug 2009 07:26:29 GMT</pubDate>
			<description><![CDATA[This is actually a quiz in our Algorithm Analysis and Design class where we're provided a 9x9 sudoku table filled with few numbers. Now, our teacher allowed us to use any programming language, provided that it's *structural* and not OOP, in order to come up with a sudoku solver app. 
 
Here's the...]]></description>
			<content:encoded><![CDATA[<div>This is actually a quiz in our Algorithm Analysis and Design class where we're provided a 9x9 sudoku table filled with few numbers. Now, our teacher allowed us to use any programming language, provided that it's <span style="font-weight:bold">structural</span> and not OOP, in order to come up with a sudoku solver app.<br />
<br />
Here's the catch, the 9x9 sudoku grid has few numbers and the program should be able to fill in possible numbers to complete the grid.<br />
<br />
I decided to start programming/coding it on ruby by making 9 arrays, assuming that they're the 9 rows.<br />
<br />
Note that we have to provide the algorithm though.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>ClimaxBeetle</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread211815.html</guid>
		</item>
	</channel>
</rss>
