这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » FPGA » FPGA发送数据。

共1条 1/1 1 跳转至

FPGA发送数据。

菜鸟
2015-10-19 17:47:19     打赏
	大虾请教,是否可以解释下如下逻辑。谢谢了
        clkbps			:dff;
	serdata[10..0]		:dff;
	loaddata		:dff;
	wordcnt[4..0]		:dff;
        spwordcnt[7..0]	        :dff;
		
                if ((spwordcnt[]>=H"B") & (spwordcnt[]<=H"FF")) then
			
			TXout=VCC;
		end if;

		if (spwordcnt[]==H"FF") then
			spwordcnt[]=0;
			TXout=VCC;

		else
			spwordcnt[]=spwordcnt[]+1;
		end if;
		spwordcnt[].clk = clkword;		
		spwordcnt[].clrn = aclrn;
				
		loaddata=(wordcnt[]==1);
		loaddata.clk=clkbps;
		test1 = loaddata;	
		
		if (loaddata) then
		case spwordcnt[] is
					when H"0" =>
						serdata[].d = B"11011110010" & loaddata;
					when H"1" =>
						serdata[].d = B"11000001000" & loaddata;
					when H"2" =>
						serdata[].d = B"10000000000" & loaddata;
					when H"3" =>
						serdata[].d = B"10000001100" & loaddata;
					when H"4" =>
						serdata[].d = B"11000000010" & loaddata;
					when H"5" =>
						serdata[].d = B"11000000010" & loaddata;
					when H"6" =>
						serdata[].d = B"11000000100" & loaddata;
					when H"7" =>
						serdata[].d = B"10000000000" & loaddata;
					when H"8" =>
						serdata[].d = B"11000100000" & loaddata;
					when H"9" =>
						serdata[].d = B"10001001110" & loaddata;
					when H"A" =>
						serdata[].d = B"10101111100" & loaddata;
						
			end case;
				serdata[].clk = !clkbps;
--			serdata[].d=B"11011110010" & loaddata;

			else -- (wordcnt[]>1) 

			TXout = serdata0;
			serdata[9..0].d = serdata[10..1].q;
			serdata10.d = VCC;
			serdata[].clk = !clkbps;
		end if;
			

 




共1条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]