2020年3月1日 星期日

EX6-3.5 Half Subtractor circuit


EX6-3.5   Half  Subtractor circuit

//===============================
// ex6-3.5 Half Substrator circuit

module EX10_13( A, B ,Bout ,Diff);

input  A,B ; // 1位元輸入

output  reg Bout ,Diff ; // Output    1位元輸出

always@ ( A,B) begin

{Bout ,Diff}= A-B;
end
endmodule

//===============================
// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps     
module Test_bench;
    // Inputs
    reg A,B;

    // Outputs
    wire Bout ,Diff ;

    // Instantiate the Unit Under Test (UUT)
    // ex6-3.5 Half Substrator circuit 
     EX10_13  UUT (
        .A(A), 
        .B(B), 
        .Bout(Bout) ,
        .Diff(Diff)
    );

    initial begin
        $monitor( A, B ,Bout ,Diff);
        //Apply inputs
A=1'b0; B=1'b0; 
        #100;
{A,B}=2'b01;
        #100;
{A,B}=2'b10;
        #100;
{A,B}=2'b11;
        #100;
   
    end
    initial begin
#400  $stop;
end
endmodule

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...