2020年5月13日 星期三

Combinational Logic with always ----4x16 Decoder

Combinational Logic with always ----4x16 Decoder






//4x16 Decoder
module Deocder_4x16 ( en,in,out);

 input   en;
 input   [3:0]in;
 output  reg [15:0]out;

  always @ (en or in) begin
    out = en ? 1 << in: 0;
  end

endmodule

//=================================
`timescale 100ns/10ns

  module tb;
  reg en;
  reg [3:0] in;
  wire [15:0] out;
  integer i;

  Deocder_4x16  UUT ( .en(en), .in(in), .out(out));

  initial begin
    en <= 0;
    in <= 0;

    $monitor("en=%0b in=0x%0h out=0x%0h", en, in, out);

    for (i = 0; i <=32; i = i + 1) begin
      {en, in} = i;
      #10;
    end
  end

endmodule



沒有留言:

張貼留言

Telegram Bot 即時告警推播 與 每 30 分鐘定時遙測回報

Telegram Bot 即時告警推播 與 每 30 分鐘定時遙測回報   將 Telegram Bot 即時告警推播 與 每 30 分鐘定時遙測回報 完整整合進程式中。 新增功能重點 Telegram 推播設定面板(區塊 2-B) :可直接輸入 Bot Token 與 ...