⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scinode2.vhd

📁 VHDL 关于2DFFT设计程序 u scinode1 &#8764 scinode9.vhd: Every SCI node RTL vhdl code. The details can be
💻 VHD
📖 第 1 页 / 共 4 页
字号:
			else
				case where_to_send is
				when 0 =>
					data_out <= req_xmit_q( req_xmit_q_first )(3);
				when 1 => 
					data_out <= res_xmit_q( res_xmit_q_first )(3);
				when 2 =>				--send over the bypass_fifo & clear bypass_fifo
					data_out <= bypass_fifo( bypass_fifo_ptr )(4);
					bypass_fifo( bypass_fifo_ptr )(0) <= "1111111111111111";		bypass_fifo( bypass_fifo_ptr )(1) <= "1111111111111111";
					bypass_fifo( bypass_fifo_ptr )(2) <= "1111111111111111";		bypass_fifo( bypass_fifo_ptr )(3) <= "1111111111111111";
					bypass_fifo( bypass_fifo_ptr )(4) <= "1111111111111111";
				when others =>
					data_out <= "1111111111111111";			
				end case;
--			counter <= 5;
				if( where_to_send = 4 or where_to_send = 3 or where_to_send = 2 ) then
					priority_flg <= 0;
				else
					priority_flg <= where_to_send + 1;
				end if;
			end if;
		when others =>			--send idle packet
			data_out <= "1111111111111111";
--			counter <= 0;
		end case;
-- reciever segment code;
		case counter is
		when 0 =>
			if( global_cnt = 0 ) then
				where_to_store <= 0;
			else
				case targetId(7 downto 0) is
				when AddressId => 
					where_to_store <= 1;		--recieve the packet into the scinode reciever queue
				when "11111111" =>				--skip idle packet,
				when others =>
					bypass_fifo( bypass_fifo_last )(0) <= data_in;
					where_to_store <= 3;					
				end case;
			end if;
			counter <= 1;
		when 1 =>
			case where_to_store is
			when 1 =>					--place the data_in into the res_rec_q or req_rec_q
				case command is
				when "00" =>
					if( req_rec_q_full = '1' ) then
						where_to_store <= 4;
						stripper_q( stripper_q_last )(1) <= "0000000000000001";
						stripper_q( stripper_q_last )(2) <= "00000000" & AddressId;
						stripper_q( stripper_q_last )(3) <= "0000000000000001";
					else
						where_to_store <= 1;
					end if;
				when "10" =>			--response packet
					if( res_rec_q_full = '1' ) then
						where_to_store <= 4;
						stripper_q( stripper_q_last )(1) <= "0000000000000011";
						stripper_q( stripper_q_last )(2) <= "00000000" & AddressId;
						stripper_q( stripper_q_last )(3) <= "0000000000000001";
					else
						where_to_store <= 2;
					end if;					
				when "01" =>			--request echo
					echo_flag <= 1;
				when "11" =>			--response echo
					echo_flag <= 2;
				when others =>
				end case;
			when 3 =>					--bypass_fifo
				bypass_fifo( bypass_fifo_last )(1) <= data_in;
			when others =>
			end case;
			counter <= 2;
		when 2 =>
			case echo_flag is
			when 0 =>					--not echo message;
				case where_to_store is
				when 1 =>
					req_rec_q( req_rec_q_last )(0) <= data_in;
				when 2 =>
					res_rec_q( res_rec_q_last )(0) <= data_in;
				when 3 =>
					bypass_fifo( bypass_fifo_last )(2) <= data_in;
				when 4 =>
					stripper_q( stripper_q_last )(0) <= data_in;
					if( stripper_q_last = 3 ) then
						stripper_q_last <= 0;
					else
						stripper_q_last <= stripper_q_last + 1;
					end if;
				when others =>
				end case;
			when others =>
				echo_sourceId <= data_in(7 downto 0);
			end case;
			counter <= 3;
		when 3 =>
			case echo_flag is
			when 0 =>
				case where_to_store is
				when 1 =>
					req_rec_q( req_rec_q_last )(1) <= data_in;
				when 2 =>
					res_rec_q( res_rec_q_last )(1) <= data_in;				
				when 3 =>
					bypass_fifo( bypass_fifo_last )(3) <= data_in;
				when others =>
				end case;
			when 1 =>					--request echo
				if( data_in(0) = '0' ) then	--the transaction is complete
					if( req_xmit_q( req_xmit_q_first )(0)(7 downto 0) = echo_sourceId ) then
						req_xmit_q_flg( req_xmit_q_first ) <= 0;
						if( req_xmit_q_first = 3 ) then
							req_xmit_q_first <= 0;
						else
							req_xmit_q_first <= req_xmit_q_first + 1;
						end if;
					end if;
				else					--resent the previous request packet
					if( req_xmit_q( req_xmit_q_first )(0)(7 downto 0) = echo_sourceId ) then
						req_xmit_q_flg( req_xmit_q_first ) <= 2;
					end if;						
				end if;
			when 2 =>					--response echo
				if( data_in(0) = '0' ) then	--the transaction is complete
					if( res_xmit_q( res_xmit_q_first )(0)(7 downto 0) = echo_sourceId ) then
						res_xmit_q_flg( res_xmit_q_first ) <= 0;
						if( res_xmit_q_first = 3 ) then
							res_xmit_q_first <= 0;
						else
							res_xmit_q_first <= res_xmit_q_first + 1;
						end if;
					end if;
				else
					if( res_xmit_q( res_xmit_q_first )(0)(7 downto 0) = echo_sourceId ) then
						res_xmit_q_flg( res_xmit_q_first ) <= 2;
					end if;					
				end if;				
			end case;
			counter <= 4;
		when 4 =>
			case echo_flag is
			when 0 =>
				case where_to_store is
				when 1 =>
					req_rec_q( req_rec_q_last )(2) <= data_in;
					if( req_rec_q_last = 3 ) then
						req_rec_q_last <= 0;
					else
						req_rec_q_last <= req_rec_q_last + 1;
					end if;
				when 2 =>
					res_rec_q( res_rec_q_last )(2) <= data_in;
					if( res_rec_q_last = 3 ) then
						res_rec_q_last <= 0;
					else
						res_rec_q_last <= res_rec_q_last + 1;
					end if;					
				when 3 =>
					bypass_fifo( bypass_fifo_last )(4) <= data_in;
					if( bypass_fifo_last = 3 ) then
						bypass_fifo_last <= 0;
					else
						bypass_fifo_last <= bypass_fifo_last + 1;
					end if;
				when others =>	
				end case;
			when others =>
			end case;
			counter <= 5;
		when others =>				--truncate the idle packet
			counter <= 0;
			if( echo_flag = 0 ) then
				case where_to_store is			--check if queue is full
				when 2 =>
					if( res_rec_q_last = res_rec_q_first ) then
						res_rec_q_full <= '1';
					end if;
				when 1 =>
					if( req_rec_q_last = req_rec_q_first ) then
						req_rec_q_full <= '1';
					end if;
				when others =>
				end case;
			end if;
			echo_flag <= 0;	
			where_to_store <= 0;
		end case;
--Manupulate the recieving data
		if( counter = 0 ) then
			if( req_rec_q_full = '1' or ( process_priority /= 2 and req_rec_q_first /= req_rec_q_last )) then
				if( req_rec_q( req_rec_q_first )(1)(8) = '0' ) then			--request packet and store data;
					case req_rec_q( req_rec_q_first )(1)(3 downto 0) is
					when "0000" =>
						a_tmp(0) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(0) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "0001" =>
						a_tmp(1) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(1) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "0010" =>
						a_tmp(2) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(2) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "0011" =>
						a_tmp(3) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(3) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "0100" =>
						a_tmp(4) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(4) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "0101" =>
						a_tmp(5) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(5) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "0110" =>
						a_tmp(6) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(6) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "0111" =>
						a_tmp(7) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(7) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when "1000" =>
						a_tmp(8) <=	req_rec_q( req_rec_q_first )(2)(15 downto 8);
						b_tmp(8) <= req_rec_q( req_rec_q_first )(2)(7 downto 0);
					when others =>
					end case;
					stripper_q( stripper_q_last )(0) <= req_rec_q( req_rec_q_first )(0);	--insert request echo
					stripper_q( stripper_q_last )(1) <= "0000000000000001";
					stripper_q( stripper_q_last )(2) <= "00000000" & AddressId;
					stripper_q( stripper_q_last )(3) <= "0000000000000000";
					if( stripper_q_last = 3 ) then	--update the stripper_q_last
						stripper_q_last <= 0;
					else
						stripper_q_last <= stripper_q_last + 1;
					end if;
					if( req_rec_q_first = 3 ) then
						req_rec_q_first <= 0;
					else
						req_rec_q_first <= req_rec_q_first + 1;
					end if;
					req_rec_q_full <= '0';			--deassert the req_rec_q_full signal
				end if;								--request packet and load data; NOT IMPLEMENT!!!!
				process_priority <= 2;
			elsif( res_rec_q_full = '1' or ( process_priority /= 1 and res_rec_q_first /= res_rec_q_last )) then
				if( res_rec_q( res_rec_q_first )(1)(8) = '0' ) then			--request packet and store data;
					case res_rec_q( res_rec_q_first )(1)(3 downto 0) is
					when "0000" =>
						a_tmp(0) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(0) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "0001" =>
						a_tmp(1) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(1) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "0010" =>
						a_tmp(2) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(2) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "0011" =>
						a_tmp(3) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(3) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "0100" =>
						a_tmp(4) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(4) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "0101" =>
						a_tmp(5) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(5) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "0110" =>
						a_tmp(6) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(6) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "0111" =>
						a_tmp(7) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(7) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when "1000" =>
						a_tmp(8) <=	res_rec_q( res_rec_q_first )(2)(15 downto 8);
						b_tmp(8) <= res_rec_q( res_rec_q_first )(2)(7 downto 0);
					when others =>
					end case;
					stripper_q( stripper_q_last )(0) <= req_rec_q( req_rec_q_first )(0);	--insert request echo
					stripper_q( stripper_q_last )(1) <= "0000000000000011";
					stripper_q( stripper_q_last )(2) <= "00000000" & AddressId;
					stripper_q( stripper_q_last )(3) <= "0000000000000000";
					if( stripper_q_last = 3 ) then	--update the stripper_q_last
						stripper_q_last <= 0;
					else
						stripper_q_last <= stripper_q_last + 1;
					end if;

					if( res_rec_q_first = 3 ) then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -