數位IC設計入門-Verilog combinational logic
1 to 8 DeMultiplexer 解多工器 Behavioral Modeling (& Test Bench)
//數位IC設計入門-Verilog combinational logic
// 1 to 8 DeMultiplexer 解多工器 Behavioral Modeling (& Test Bench)
module DEMUX1x8(in, select, out);
input in;
input [2:0] select;
output reg [7:0]out;
always@(in or select)
begin
out = 8'd0;
case(select)
3'd0 : out[0] = in;
3'd1 : out[1] = in;
3'd2 : out[2] = in;
3'd3 : out[3] = in;
3'd4 : out[4] = in;
3'd5 : out[5] = in;
3'd6 : out[6] = in;
3'd7 : out[7] = in;
endcase
end
endmodule
// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps
module Test_bench;
//module DEMUX1x8(in, select, out);
//input in;
//input [2:0] select;
//output reg [7:0]=out;
// Inputs
reg in=0;
reg [2:0] select=3'b000;
// Outputs
wire [7:0]out;
// Instantiate the Unit Under Test (UUT)
// DEMUX1x8(in, select, out);
DEMUX1x8 UUT(in, select, out);
initial begin
$monitor(in, select, out);
// Initialize Inputs
//#25 {a,b,c,d,e,f,g,h}=8'b0000_0000 ; select[2:0]=3'b000 ;
#20 in=1; select[2:0]=3'b000 ;
#20 in=0 ; select[2:0]=3'b001 ;
#20 in=1 ; select[2:0]=3'b001 ;
#20 in=0 ; select[2:0]=3'b010 ;
#20 in=1 ; select[2:0]=3'b010 ;
#20 in=0 ; select[2:0]=3'b011 ;
#20 in=1 ; select[2:0]=3'b011 ;
#20 in=0 ; select[2:0]=3'b100 ;
#20 in=1 ; select[2:0]=3'b100 ;
#20 in=0 ; select[2:0]=3'b101 ;
#20 in=1 ; select[2:0]=3'b101 ;
#20 in=0 ; select[2:0]=3'b110 ;
#20 in=1 ; select[2:0]=3'b110 ;
#20 in=0 ; select[2:0]=3'b111 ;
#20 in=1 ; select[2:0]=3'b111 ;
end
initial
begin
#325; // 模擬終止時間 325 ns
$stop;
end
endmodule
訂閱:
張貼留言 (Atom)
MIFARE Classic Command Flow Diagram
MIFARE Classic Command Flow Diagram 這個程式將圖片中的 MIFARE Classic Command Flow Diagram 完整繪製在畫布上(包含中英文對照、虛線錯誤返回路徑、實線流程箭頭以及右側的「典型交易時間」資訊),並提供「上一...
-
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 下載...
-
ESP32 DHT22 + Telegram Telegram Bot 指令列表 /start - 開始對話 /help - 指令說明 /status - 查詢目前溫濕度 /mute - 暫停變化通知 /resume - 恢復變化通知 /stopreport - 停止定時回報 /...



沒有留言:
張貼留言