【正文】
成,分別為主進程( main)、分頻進程( m)、譯碼顯示進程( translate)組成。由于有 16 種商品,可以通過兩次按鍵來完成。 1 提供全套畢業(yè)設計,歡迎咨詢 基于 VHDL 的自動售貨機 設計報告 組員: 2020920 目錄 2 面…………………………………………………………… 1 …………………………………………………………… 2 …………………………………………………………… 3 …………………………………………………………… 4 ( 1) 程序結(jié)構(gòu)介紹 …………………………………………… 4 ① 主進程 ………………………………… ……… … 4 ② 分頻進程……………………………… ………… 5 ③ 譯碼顯示進程…………………………………… 6 ( 2) 設計中遇到的問題及 解 決 …………………………… … 6 …………………………………………………… 7 …………………………………………… … 10 …………………………………………………… ……… 10 ……………………………………………………… …… 10 ………………………………………… …………… 22 一、導言 在 2114 年 短 學期中,我組成員在?數(shù)字系統(tǒng)課程設計?課程中成功按題目要求設計完成了目標系統(tǒng) —— 基于 VHDL 的自動售貨機模擬 3 系統(tǒng)。 ( 3)顧客選擇完商品后,可以選擇需要的數(shù)量,數(shù)量為 13 件。 ( 1) 主進程( main) 主進程為分為 9 個狀態(tài),按主進程流程順序分別為開始狀態(tài)( sstart) , 第 一 個 商 品 種 類 編 號 的 十 位 、 個 位 選 擇 狀 態(tài)( schoGoods10 、 schoGoods11) , 第 一 個 商 品 數(shù) 量 選 擇 狀 態(tài)( choNum1) ,第 二 個 商品 種 類編 號 的 十位 、 個位 選 擇狀 態(tài)( schoGoods20 、 schoGoods21) , 第 二 個 商 品 數(shù) 量 選 擇 狀 態(tài)( choNum2),付款狀態(tài)( spayment),找零狀態(tài)( srefund)。 ④ 第二個商品的種類及數(shù)量 選擇過程( choGood choGoods2choNum2)與第一個類似,不做贅述。 ( 2) 分頻進程( m) 分頻進程將 100Mhz 時鐘信號擴大 2020000 倍。解決的辦法是將讀取按鍵值的思路改為讀取按鍵上升沿。 選 09 號( shift=1) 3 個, 01號商品 1 個,投入 40元( c20*2),則找零 12元( co10*1+co1*2),邏輯正確,驗證了 shift 功能。 ④ 要使系統(tǒng)更為完善,仍可做一下改進 1) 將返回上一層功能調(diào)試完成。 六 、附錄 library IEEE。 按鈕輸入 c1,c5,c10,c20: in std_logic。 11 choOut3:out std_logic。 signal sneedMoney: integer range 0 to 96。 選擇的商品 variable choNum1,choNum2: integer range 0 to 3。 variable unablebut0,unablebut1,unablebut2,unablebut3,unablebut4:std_logic。 12 tempCo1:=0。 lastOk:=ok。 lout4=39。 unablec1:=c1。 unablebut4:=but4。) then unablebut0:=39。039。) then choGoods1:=0。 and unablebut1=39。 13 sneedMoney=needMoney。039。 and unablebut1=39。139。) then unablebut3:=39。039。) then choGoods1:=0。039。 and unablebut2=39。139。 elsif(but4=39。139。) then choGoods1:=5。039。 and unablebut2=39。139。 elsif(but4=39。139。) then choGoods1:=10。039。 and unablebut2=39。139。 elsif(but4=39。139。) then choGoods1:=15。039。 needMoney:=choGoods1。139。 end if。 if(but1=39。039。 and unablebut3=39。039。 and unablebut1=39。139。 elsif(but3=39。139。139。 lout2=39。) then state=sstart。 end if。 if(but1=39。139。 and but1=39。 end if。 if(rst=39。) then unablebut0:=39。039。 end if。 if(but4=39。039。ableOk:=39。139。unablebut2:=39。) then choGoods2:=3。039。139。ableOk:=39。139。 unablebut2:=39。 and choGoods1=0) then choGoods2:=8。039。039。 ableOk:=39。139。unablebut2:=39。) then choGoods2:=13。039。139。 ableOk:=39。139。139。 lout2=39。039。139。) then unablebut1:=39。039。 end if。ableOk:=39。139。unablebut2:=39。) then choNum2:=3。) then lastOk:=ok。 end if。 if(rst=39。 unablebut2:=39。 and unablec1=39。139。) then unablec10:=39。039。 end if。 end if。 end if。end if。end if。 else if(totMoney=needMoney) then totMoney:=totMoneyneedMoney。 end if。 tempCo5:=tempCo5+1。 19 if(ok/=lastOk and ableOk=39。 end case。) then if(i=4000000 or i0) then i:=0。 if(j=400000 and j=0) then j:=j+1。 case choClk is when 0 = choOut0=39。 when 1 = choOut0=39。 when 2 = choOut0=39。 when 3 = choOut0=39。 end case。 variable needMoney1:integer range 0 to 99。 end if。 when 4=outMoney=10011001。 istotDone0:=39。 if(totMoney1=10 and j0=9) then totMoney1:=totMoney110。 when 4=outMoney=10011001。 istotDone1:=39。 isneedDone0:=39。 when 6=outMoney=01000001。 end if。 isneedDone1:=39。 when 6=outMoney=01000001。 end if。 end if。 when 8=outMoney=00000001。 else case j1 is when 0=outMoney=00000011。139。 when 8=outMoney=00000001。 else case needMoney0 is when 0=outMoney=00000011。 end if。 when 6=outMoney=01000001。 istotDone1:=39。 end if。 when 6=outMoney=01000001。 istotDone0:=39。 begin if(clk39。 20 end process。choOut1=39。choOut1=39。choOut1=39。choOut1=39。 end if。 i:=i+1。 end process main。) then state=sstart。 tempCo1:=tempCo1+1。139。 lout3=39。 if (lastcancel/=cancel)then lastcancel:=cancel。139。139。139。139。 if(isAdd=39。end if。039。) then unablec1:=39。 unablebut3:=39。) then state=sstart。 lout2=39。039。139。ableOk:=39。139。 elsif(but1=39。139。 if(but3=39。 end if。039。139。 ableOk:=39。 en