vhdl简易售货机的设计(实验报告)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

石家庄经济学院华信学院数字逻辑课程设计报告题目基于VHDL的设计与实现姓名学号班号指导老师成绩2012年6月目录1.引言···························································································21.1设计目的·················································································21.2设计任务·················································································32.总体设计·····················································································43.详细设计及实现··············································································3.1XX模块的设计及实现·······························································(给出此模块的功能、引脚说明、加注释的VHDL代码、加说明的仿真波形图)3.2XX模块的设计及实现···············································································································································································································································································3.n顶层实体的设计及实现·······························································4.总结参考文献一、实习目的1.使学生更好地巩固和加深对基础知识的理解,学会设计中小型数字系统的方法,独立完成调试过程,增强学生理论联系实际的能力,提高学生电路设计和分析的能力。2.通过实践教学引导学生在理论指导下有所创新,为后继专业课的学习和日后工程实践奠定基础。二、实习要求1.综合应用课程中学到的理论知识,独立完成一个设计任务。2.根据所要完成的设计任务,采用模块化设计方法,底层的元件使用硬件描述语言VHDL进行描述,顶层采用原理图的方法。依靠计算机,借助EDA开发工具,实现系统功能。3.整理设计报告及相关的文档(包括总体设计思想、设计说明、程序源代码、仿真结果图、设计总结等)。三、设计内容1.简易售货机的设计任务和要求:自动售货机可销售巧克力(0.5元)、纯净水(1元)、牛奶(1.5元)、汉堡(2元)4种商品,只能投入1元或5角硬币,当投入的币值等于或大于商品的价钱且确认购买时,两个输出口分别输出购买的商品和找零;当取消购买时,售货机退出所投的硬币。另外,有两个LED数码管显示已经投入的币值或找零数(或退币数)。四、总体设计本程序中clk为系统时钟buy,sel,reset买、选择、退币信号c5,c10、5角硬币、1元硬币A,B,C,D种类信号act出货信号当系统时钟处于上升沿时,对商品名进行选择,并输出商品价格,当输入不同面值的硬币时分别加上不同硬币的面值,判断当前输入的硬币值是否大于当前所选物品的面值:(1)大于等于时:物品输出信号为1并找回剩余钱数,(2)小于时:物品输出信号为0并退回所输入的硬币。五、详细设计及实验(1)对四种物品进行选择caseseliswhen1000=coi=coi+5;when0100=coi=coi+01010;when0010=coi=coi+01111;when0001=coi=coi+10100;whenothers=coi=coi+0;endcase;(2)对硬币的面值进行累加ifcoin1='1'thencoin=coin+00101;elsifcoin2='1'thencoin=coin+01010;endif;(3)判断当前输入的硬币值是否大于当前所选铅笔的面值并进行退币和找币工作ifget='1'thencasecoiiswhen00101=ifcoin00100thenact='1';coin=coin-00101;coi=coi-00101;out1=coin;elseact='0';coi=coi-00101;out1=coin;endif;when01010=ifcoin01001thenact='1';coin=coin-10;coi=coi-10;out1=coin;elseact='0';coi=coi-10;out1=coin;endif;when01111=ifcoin01110thenact='1';coin=coin-15;coi=coi-15;out1=coin;elseact='0';coi=coi-15;out1=coin;endif;when10100=ifcoin10011thenact='1';coin=coin-20;coi=coi-20;out1=coin;elseact='0';coi=coi-20;out1=coin;endif;whenothers=act='0';endcase;endif;ifact='1'thenact='0';endif;iffuwei='1'thenact='0';endif;ifcoi=0000thenifcoin00000thenout1=00001;coin=coin-1;elseout1=00000;endif;endif;endif;五、VHDL实现LIBRARYieee;USEieee.STD_LOGIC_1164.ALL;USEieee.STD_LOGIC_unsigned.ALL;ENTITYshouhuoISPORT(clk:IN······························································STD_LOGIC;·················································································································································································coin1,coin2:IN·························································································STD_LOGIC;·······················································································································································································fuwei:IN·························································································STD_LOGIC;·························································································································································A,B,C,D:instd_logic;get········································································································································································:IN·························································································STD_LOGIC;y0:outstd_logic_vector(6downto0);coi:BUFFER·····················STD_LOGIC_VECTOR(4DOWNTO0);out1:OUT·····················STD_LOGIC_vector(4downto0);act:BUFFER····································STD_LOGIC);·································································································END;ARCHITECTUREoneOFshouhuoIS································SIGNALcoin:STD_LOGIC_VECTOR(4DOWNTO0);·································SIGNALsel:STD_LOGIC_VECTOR(3DOWNTO0);·································································································BEGINsel=A&B&C&D;process(clk)beginifclk='1'thencaseseliswhen1000=coi=coi+5;when0100=coi=coi+01010;when0010=coi=coi+01111;when0001=coi=coi+10100;whenothers=coi=coi+0;endcase;ifcoin1='1'thencoin=coin+00101;elsifcoin2='1'thencoin=coin+01010;endif;ifget='1'thencasecoiiswhen00101=ifcoin00100thenact='1';coin=coin-00101;coi=coi-00101;out1=coin;elseact='0';coi=coi-00101;out1=coin;endif;when01010=ifcoin01001thenact='1';coin=coin-10;coi=coi-10;out1=coin;elseact='0';coi=coi-10;out1=coin;endif;when01111=ifcoin01110thenact='1';coin=coin-15;coi=coi-15;out1=coin;elseact='0';coi=coi-15;out1=coin;endi

1 / 11
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功