【正文】
PlanAhead Generated physical constraints NET savekey LOC = F7。 NET rst LOC = E9。 NET pianxuan[6] LOC = L13。 NET pianxuan[4] LOC = N13。 NET pianxuan[2] LOC = H13。 NET pianxuan[0] LOC = J13。 NET number[5] LOC = A11。 NET number[3] LOC = C10。 NET number[1] LOC = B10。 NET led LOC = C7。 根據(jù)設(shè)計所做仿真如下 : 圖 19 使能模塊仿真圖 由仿真圖可見 ,每當(dāng)按鍵一次 ,在上升沿來到時 ,輸出信號波形圖翻轉(zhuǎn)一次 ,實現(xiàn)每按鍵一次 ,使能信號變化一次 . 四 、設(shè)計實現(xiàn) 頂層設(shè)計 在 ise軟件中 ,可以采用原理圖的輸入方式完成電路的設(shè)計 . 分單元設(shè)計好每個模塊以后 ,通過電路圖將各個部分連接到一起 ,實現(xiàn)頂層設(shè)計 ,頂層設(shè)計系統(tǒng)圖如下 : 圖 20 系統(tǒng)頂層設(shè)計圖 19 管腳分配 和 下載實現(xiàn) 管腳分配圖示在系統(tǒng)設(shè)計圖中 可以看出 ,管腳 分配的具體命令交由 ucf 文件實現(xiàn) ,具體命令如下 : NET clk LOC = N9。 e=e1。 end if。 architecture Behavioral of en is signal e1:STD_LOGIC。 e : out STD_LOGIC)。 use 。 18 use 。 end Behavioral。 end case。 when 1001 = led7=0000100。 when 0111 = led7=0001111。 when 0101 = led7=0100100。 when 0011 = led7=0000110。 when 0001 = led7=1001111。 led7:to decide the number process(data) begin led7=0000000。 end case。sel=11110111。sel=11111011。sel=11111110。sel=01111111。sel=11011111。sel=11101111。 end process。 end if。 begin scan choose 1 from 6 process(clk) begin if rising_edge (clk) then if t=101 then t=000。 architecture Behavioral of contro is signal t:STD_LOGIC_VECTOR (2 downto 0):=000。 led7 : out STD_LOGIC_VECTOR (6 downto 0))。 cs : in STD_LOGIC_VECTOR (3 downto 0)。 sl : in STD_LOGIC_VECTOR (3 downto 0)。 ml : in STD_LOGIC_VECTOR (3 downto 0)。 entity contro is Port ( clk : in STD_LOGIC。 use 。 15 寄存器 仿真波形 圖如下 : 由圖 ,在 按鍵脈沖上升沿來到之前 ,輸入直接輸出 ,程序只進(jìn)行了對數(shù)據(jù)的存儲功能 (由于截圖大小在報告中顯示范圍的有限 ,只記錄第 4 次按鍵及之后的圖形 ),當(dāng)?shù)谖宕?,按下latchin 時 ,輸出為第一次按鍵時的輸入值 ,按第 6 次時 ,輸出為第二次記錄 時的輸入值 .依次類推 ,當(dāng)?shù)?8 次按鍵以后 ,再按第 9 次 ,程序又重復(fù)循環(huán) . 圖 13 寄存器仿真波形圖 顯示控制模塊 實驗板上設(shè)計了 8 位 7 段數(shù)碼顯示 ,以便編程者將基本的數(shù)字信息通過數(shù)碼管顯示出來 ,原理圖如下: 圖 15 顯示控制原理圖 在控制電路部分 ,使用了一組 PNP 三極管( Q1~ Q8)將正極的控制電平由高電平轉(zhuǎn)為低電平 ,這樣數(shù)碼管的位數(shù)和段位的控制都統(tǒng)一成了低電平有效 .在位數(shù)控制部分加入了38 譯碼器以簡化位數(shù)編碼 ,用 DIG 接口的二進(jìn)制數(shù)據(jù) 000~ 111 直接表示數(shù)碼管第一位到第八位的位選信號 . 利用 動態(tài)掃描原理和設(shè)計要求 ,顯示控制模塊包含一個六 選一數(shù)據(jù) 器、 三八譯碼器 和七段譯碼器 .六進(jìn)制計數(shù)器 通過 t 依次加 1 來控制使每次 只將一路輸入數(shù)據(jù)賦給輸出 ,六選一數(shù)據(jù)選擇器 利用 t的依次加 1來輪番從低位至高位選擇輸入口 ,三八譯碼器根據(jù)t 的值判斷選擇輸入端 ,以完成顯示的位選 .用 case 語句來決定當(dāng)輸入口決定以后 ,輸入口的數(shù)據(jù)要顯示為具體多少數(shù)值 .此步驟對照數(shù)碼管的段選來完成 . 原理框圖的設(shè)計如下所示 : 圖 16 顯示控制模塊框圖 16 具體程序設(shè)計如下 : library IEEE。csout=cs11out。slout=sl11out。mlout=ml11out。 end process。cs11out=csin。sl11out=slin。ml11out=mlin。cs11out=cs4out。sl11out=sl4out。ml11out=ml4out。cs11out=cs3out。sl11out=sl3out。ml11out=ml3out。cs11out=cs2out。sl11out=sl2out。ml11out=ml2out。cs11out=cs1out。sl11out=sl1out。ml11out=ml1out。cs11out=csin。sl11out=slin。ml11out=mlin。cs11out=csin。sl11out=slin。ml11out=mlin。cs4out=csin。sl4out=slin。ml4out=mlin。cs11out=csin。sl11out=slin。ml11out=mlin。cs3out=csin。sl3out=slin。ml3out=mlin。cs11out=csin。sl11out=slin。ml11out=mlin。cs2out=csin。sl2out=slin。ml2out=mlin。cs11out=csin。sl11out=slin。ml11out=mlin。cs1out=csin。sl1out=slin。ml1out=mlin。 end process。 end if。 then if count=1000 then count=0000。event and lacthin=39。 then count=0000。 begin process(lacthin,reset) begin if reset=39。 signal mh11out,ml11out,sh11out,sl11out,ds11out,cs11out:std_logic_vector(3 downto 0)。 signal mh3out,ml3out,sh3out,sl3out,ds3out,cs3out:std_logic_vector(3 downto 0)。 architecture Behavioral of save2 is signal mh1out,ml1out,sh1out,sl1out,ds1out,cs1out:std_logic_vector(3 downto 0)。 csout : out STD_LOGIC_VECTOR (3 downto 0))。 slout : out STD_LOGIC_VECTOR (3 downto 0)。 mlout : out STD_LOGIC_VECTOR (3 downto 0)。 csin : in STD_LOGIC_VECTOR (3 downto 0)。 slin : in STD_LOGIC_VECTOR (3 downto