2012年10月9日 星期二

bufif0及bufif1建立之4對1多工器

bufif0bufif1建立之41多工器Verilong程式

module mux4_1(s, i, y);
  input [1:0]s;
  input [3:0]i;
  output y;
  wire y0,y1;
  bufif0(y0,i[0],s[0]);
  bufif1(y0,i[1],s[0]);
  bufif0(y1,i[2],s[0]);
  bufif1(y1,i[3],s[0]);
  bufif0(y,y0,s[1]);
  bufif1(y,y1,s[1]);

endmodule

//============================

`timescale 1ns / 1ps
module testbench;

        reg [1:0] s=0;  // Inputs
        reg [3:0] i=0;
        wire  y;     // Outputs
        // Instantiate the Unit Under Test (UUT)
        zaq uut (.s(s),.i(i),.y(y) );
        initial begin
                #200 s=00;i=0001;
                #200 s=01;i=0010;
                #200 s=10;i=0100;
                #200 s=11;i=1000;
                #200 s=00;i=0001;
        end

   initial #1000 $finish;
 initial $monitor("Time = %3g,s = %b,i = %b,y = %4b",$time,s,i,y);
endmodule


沒有留言:

張貼留言

2026 作業3 RFID+ Telegram 練習

 2026 作業3  RFID+ Telegram  練習 (Wokwi 與 Telegram 二者溝通訊息反映比較慢 ) 歡迎 Alex 使用 RFID 控制系統 /on : 開啟 LED /off : 關閉 LED /flash : 閃爍模式 /timer : 開啟 5 秒 ...