P6-22 4bit 比較器適用於DE2-70
//-----------------------------------------
// 4-bit Comparator with asynchronous reset
// (if...else if...else)
// Filename: comp4_if.v
//-----------------------------------------
module _4bit_comp(SW, LEDR, LEDG , CLOCK_27 ,KEY );
input [17:0] SW; // toggle switches
input [7:0] KEY; // Push bottom
input CLOCK_27; //Clock 27MHz , 50Mhz
output [17:0] LEDR; // red LEDS
output [7:0] LEDG; // green LEDs
//set original program input , output
// Port Declarations
// output eq, gt, lt; //outputs eq:Equal, gt:Great than, lt:Less than
// input [3:0] a, b; //4-bit inputs
wire [3:0] a,b;
reg eq, gt, lt;
//mapping to hardware
assign LEDR = SW;
assign a=SW[3:0];
assign b=SW[7:4];
always @ (a or b)
begin
if (a==b)
begin
eq = 1'b1; gt = 1'b0; lt = 1'b0;
end
else if (a > b)
begin
eq = 1'b0; gt = 1'b1; lt = 1'b0;
end
else
begin
eq = 1'b0; gt = 1'b0; lt = 1'b1;
end
end
assign LEDG[0]=lt;
assign LEDG[1]=eq;
assign LEDG[2]=gt;
endmodule
訂閱:
張貼留言 (Atom)
習題解答 (5/6)
第五章 習題解答 一、 錯誤偵測技術 1. 何謂循環冗餘檢查法 (CRC)? 是一種根據傳輸資料產生簡短固定位數校驗碼的演算法。發送端將資料除以一個特定的多項式,得到的「餘數」即為 CRC 碼並隨資料發送;接收端以同樣多項式除之,若餘數為 0 則代表資料傳輸正確。 2. 何...
-
python pip 不是内部或外部命令 -- 解決方法 要安裝 Pyqt5 1. 首先,開啟命令提示字元。 2. 輸入 pip3 install pyqt5 好像不能執行 ! ! 錯誤顯示 : ‘ pip3 ’ 不是內部或外部命令、可執行的程式或批...
-
Line 發報機 Python TKinter (CONFIG_LINE Message API_2.py) import serial import serial.tools.list_ports import tkinter as tk from tkinter import...
-
課程講義 下載 11/20 1) PPT 下載 + 程式下載 http://www.mediafire.com/file/cru4py7e8pptfda/106%E5%8B%A4%E7%9B%8A2-1.rar 11/27 2) PPT 下載...



沒有留言:
張貼留言