集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
楼主: UFP

请教串并并串转换原理

[复制链接]
usb 发表于 2010-6-28 12:01:37 | 显示全部楼层
你到底想问什么呀?
usd 发表于 2010-6-28 12:09:02 | 显示全部楼层
我觉得最好能有人给出个串并并串的例子,这样就好了,光说个移位寄存器,不明白啊,和楼主一同期待
interig 发表于 2010-6-28 13:43:09 | 显示全部楼层
还是要个完整的例子才适合我们这样的入门菜鸟
VVIC 发表于 2010-6-28 13:46:18 | 显示全部楼层
顶一个,确实不错
longt 发表于 2010-6-28 14:30:07 | 显示全部楼层
都可以采用移位寄存器实现
longt 发表于 2010-6-28 15:28:44 | 显示全部楼层
begin<br>
counter: process(reset,clk,shift_start)<br>
begin<br>
&nbsp;&nbsp;if(reset = '0') then<br>
&nbsp; &nbsp;cnt &lt;= (others =&gt; '0');<br>
&nbsp;&nbsp;elsif(clk'event and clk = '1') then<br>
&nbsp; &nbsp;if(shift_start = '0') then<br>
&nbsp; &nbsp; cnt &lt;= cnt + 1;<br>
&nbsp; &nbsp;else<br>
&nbsp; &nbsp; cnt &lt;= (others =&gt; '0');<br>
&nbsp; &nbsp;end if;<br>
&nbsp;&nbsp;end if;<br>
end process counter;<br>
<br>
fsm: block<br>
begin<br>
&nbsp;&nbsp;sync: process(reset,clk)<br>
&nbsp;&nbsp;begin<br>
&nbsp; &nbsp;if(reset= '0') then<br>
&nbsp; &nbsp; current_state &lt;= idle;<br>
&nbsp; &nbsp;elsif(clk'event and clk = '1') then<br>
&nbsp; &nbsp; current_state &lt;= next_state;<br>
&nbsp; &nbsp;end if;<br>
&nbsp;&nbsp;end process sync;<br>
<br>
&nbsp;&nbsp;comb: process(current_state,cnt,start)<br>
&nbsp;&nbsp;begin<br>
&nbsp; &nbsp;case current_state is<br>
&nbsp; &nbsp; when idle =&gt;<br>
&nbsp; &nbsp;&nbsp;&nbsp;ready &lt;= '0';<br>
&nbsp; &nbsp;&nbsp;&nbsp;reg_en &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;shift_start &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;data_valid &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;if(start = '0') then<br>
&nbsp; &nbsp;&nbsp; &nbsp;reg_en &lt;= '0';<br>
&nbsp; &nbsp;&nbsp; &nbsp;next_state &lt;= recieve;<br>
&nbsp; &nbsp;&nbsp;&nbsp;else<br>
&nbsp; &nbsp;&nbsp; &nbsp;next_state &lt;= idle;<br>
&nbsp; &nbsp;&nbsp;&nbsp;end if;<br>
&nbsp; &nbsp; when recieve =&gt;<br>
&nbsp; &nbsp;&nbsp;&nbsp;reg_en &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;ready &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;data_valid &lt;= '0';<br>
&nbsp; &nbsp;&nbsp;&nbsp;shift_start &lt;= '0';<br>
&nbsp; &nbsp;&nbsp;&nbsp;next_state &lt;= shift;<br>
&nbsp; &nbsp; when shift =&gt;<br>
&nbsp; &nbsp;&nbsp;&nbsp;reg_en &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;ready &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;data_valid &lt;= '0';<br>
&nbsp; &nbsp;&nbsp;&nbsp;if(cnt = 8) then<br>
&nbsp; &nbsp;&nbsp; &nbsp;shift_start &lt;= '1';<br>
&nbsp; &nbsp;&nbsp; &nbsp;next_state &lt;= finish;<br>
&nbsp; &nbsp;&nbsp;&nbsp;else<br>
&nbsp; &nbsp;&nbsp; &nbsp;shift_start &lt;= '0';&nbsp; &nbsp;&nbsp; &nbsp;<br>
&nbsp; &nbsp;&nbsp; &nbsp;next_state &lt;= shift;<br>
&nbsp; &nbsp;&nbsp;&nbsp;end if;<br>
&nbsp; &nbsp; when finish =&gt;<br>
&nbsp; &nbsp;&nbsp;&nbsp;reg_en &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;ready &lt;= '0';<br>
&nbsp; &nbsp;&nbsp;&nbsp;data_valid &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;shift_start &lt;= '1';<br>
&nbsp; &nbsp;&nbsp;&nbsp;next_state &lt;= idle;<br>
&nbsp; &nbsp; when others =&gt;<br>
&nbsp; &nbsp;&nbsp;&nbsp;next_state &lt;= idle;<br>
&nbsp; &nbsp;end case;<br>
&nbsp;&nbsp;end process comb;<br>
<br>
end block fsm;<br>
<br>
data_channel: process(reset,clk)<br>
begin<br>
&nbsp;&nbsp;if(reset = '0') then<br>
&nbsp; &nbsp;reg &lt;= (others =&gt; '0');<br>
&nbsp; &nbsp;q&nbsp; &nbsp;&lt;= '0';<br>
&nbsp;&nbsp;elsif(clk'event and clk = '1') then<br>
&nbsp; &nbsp;if(reg_en = '0') then<br>
&nbsp; &nbsp; reg &lt;= data_in;<br>
&nbsp; &nbsp;elsif(shift_start = '0') then<br>
&nbsp; &nbsp; q &lt;= reg(7);<br>
&nbsp; &nbsp; for i in 7 downto 1 loop&nbsp; &nbsp; --shift register<br>
&nbsp; &nbsp;&nbsp;&nbsp;reg(i) &lt;= reg(i - 1);<br>
&nbsp; &nbsp; end loop;<br>
&nbsp; &nbsp; reg(0) &lt;= '0';<br>
&nbsp; &nbsp;else&nbsp;&nbsp;<br>
&nbsp; &nbsp; q &lt;= '0';<br>
&nbsp; &nbsp;end if;<br>
&nbsp;&nbsp;end if;<br>
end process data_channel; <br>
<br>
end Behavioral;<br>
<br>
并串转换,,整个代码已经通过了后仿真,而且思路还是比较清楚的,可靠性和稳定性方面也应该没有问题滴,呵呵。不过说老实话,里面有些信号是确实可以去掉的,不过后来就懒得改了。如果谁想要实际的工程中用的话可以改一下。
longtime 发表于 2010-6-28 16:24:20 | 显示全部楼层
随便一本教硬件语言的都有吧
 楼主| UFP 发表于 2010-6-28 17:07:31 | 显示全部楼层
移位寄存器和状态机都可以,不过移位寄存器要简单的多
usb 发表于 2010-6-28 17:39:53 | 显示全部楼层
就是状态机有一点麻烦,不过有时候却有好处
HDL 发表于 2010-6-28 17:45:10 | 显示全部楼层
很简单的,就用移位寄存器搞定
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2024-12-25 01:16 , Processed in 0.065390 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表