除法器设计方法内容摘要:

cess(clk) 同步数据更新进程 begin if(clk=39。 139。 and clk39。 event) then state=nextstate。 if load=39。 139。 then dividend=39。 039。 amp。 dividend_in。 end if。 if su=39。 139。 then dividend(8 downto 4)=subout。 dividend(0)=39。 139。 end if。 if sh=39。 139。 then dividend=dividend(7 downto 0)amp。 39。 039。 end if。 end if。 end process update。 end Behavioral。 library IEEE。 use。 use。 use。 entity divider is Port ( dividend_in : in std_logic_vector(7 downto 0)。 被除数 divisor : in std_logic_vector(3 downto 0)。 除数 st : in std_logic。 除法启动控制信号 clk : in std_logic。 时钟信号 quotient : out std_logic_vector(3 downto 0)。 商 remainder : out std_logic_vector(3 downto 0)。 余数 overflow : out std_logic)。 溢出标志 end divider。 architecture Behavioral of divider is signal state,nextstate:integer range 0 to 5。 signal c,load,su,sh:std_logic。 signal subout:std_logic_vector(4 downto 0)。 signal dividend:std_logic_vector(8 downto 0)。 begin subout=dividend(8 downto 4)(39。 039。 amp。 divisor)。 减法器 c=not subout(4)。 remainder=dividend(7 downto 4)。 分离出余数 quotient=dividend(3 downto 0)。 分离出商 state_graph:process(state,st,c) 状态控制器 begin load=39。 039。 overflow=39。 039。 sh=39。 039。 su=39。 039。 case state is when 0= 状态 0 :启动除法运算 if(st=39。 139。 ) then load=39。 139。 nextstate=1。 else nextstate=0。 end if。 when 1= 状态 1 :溢出判断 if(c=39。 139。 )then overflow=39。 139。 nextstate=0。 else sh=39。 139。 nextstate=2。 end if。 when 2|3|4= 状态 4:实现除法运算 if(c=39。 139。 )then su=39。 139。 nextstate=state。 else sh=39。 139。 nextstate=state+1。 end if。 when 5= 状态 5:结束运算过程,返回初始态 if(c=39。 139。 ) then su=39。 139。 end if。 nextstate=0。 end case。 end process state_graph。 update:process(clk) 同步数据更新进程 begin if(clk=39。 139。 and clk39。 event) then state=nextstate。 if load=39。 139。 then dividend=39。 039。 amp。 dividend_in。 end if。 if su=39。 139。 then dividend(8 downto 4)=subo。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。