



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
自动售邮票机代码:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity xrg4 is port(clk,clk1:in bit; coin1,coin5,coin10:in std_logic; -投入1、5、10角硬币 reset,reset1:in std_logic; -清零信号,1有效 six,eight:in std_logic; -6,8角的邮票 light:out std_logic; -购买成功指示灯 retlight:out std_logic_vector(3 downto 0) ); -找回的硬币end entity xrg4;architecture xxrr of xrg4 is type state is (s0,s1,s2);-状态机 signal n_state:state;-次态 signal c_state:state;-现态 signal touru:std_logic_vector(3 downto 0); -投入硬币面值 signal tincoint:std_logic_vector(4 downto 0);-计算出硬币总值(进程中) signal stamp:std_logic_vector(3 downto 0); -邮票面值 signal ret:std_logic_vector(3 downto 0); -找零值 signal zong:std_logic_vector(4 downto 0); -状态机硬币总值 begin p1:process(clk1) -次态给现态 begin if reset1=1then c_state=s2; elsif clk1event and clk1=1then c_state=n_state; end if; end process p1; p2:process(clk) -投入钱并计算总值 begin if reset1=1then tincoint=00000; elsif clkevent and clk=1 then if coin1=1then touru=0001; elsif coin5=1then touru=0101; elsif coin10=1then touru=1010; elsif coin1=0 and coin5=0 and coin10=0 then touru=0000; end if; tincoint=touru+tincoint; end if; end process p2; p3:process(c_state) -进行购买,找零,退钱 begin zong if six=1 then stamp=0110;n_state=s1; -选通6角或8角邮票 elsif eight=1 then stamp=1000; n_state=s1; else zong=00000;ret=0000;light=0;n_state if zongstamp then if reset=1 then ret=zong(3 downto 0); n_state=stamp then light=1;ret if six=1or eight=1thenret=zong(3 downto 0);light=0;zong=00000; n_state retlight retlight retlight retlight retlight retlight
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 统编版2025-2026学年五年级上册语文期末专项复习-词语有答案
- 江苏省盐城市2024-2025年七年级下学期期末考试历史试卷(含答案)
- 2025年江西省吉安市吉水县中考物理二模试卷(含答案)
- 城市交通智能化发展前景研究
- 酒店行业市场复苏现状与前景
- “云·仓·配”带你走进智慧新世界-智慧仓储与配送管理知到智慧树答案
- “玩”创未来知到智慧树答案
- DB15-T 3155-2023 降雪对放牧畜牧业影响预报技术规程
- 水阻柜原理课件
- 消防消防水源保障方案
- 2023届高考英语人教版一轮复习:必修第一册至选修第四册单词表讲义
- 《肿瘤筛查技术》课件
- 高温熔融金属企业安全知识培训
- 实验室生物安全手册
- 《教学勇气-漫步教师心灵原书》
- 航天禁(限)用工艺目录(2021版)-发文稿(公开)
- 医院行政办公室主任职责
- 争做“四有好老师”-当好“四个引路人”
- 外研版高中英语词汇表(全套)
- 共同风险投资协议书
- DB32-T 4752-2024 一体化污水处理设备通.用技术要求
评论
0/150
提交评论