2020年3月1日 星期日

EX5-3 已知四變數布林函數 F(a, b, c, d)


EX5-3 已知四變數布林函數 F(a, b, c, d) = abcd′ + abc + abcd + cd,請執行卡諾圖化簡,求出該函數最簡 SOP 形式。


//===============================
// Ch5.3  F(a,b,c,d) circuit

module EX10_2( a ,b, c, d, F);

input  a ,b, c ,d; // 1位元輸入

output  reg F  ; // Output    1位元輸出

always@ ( a ,b, c, d) begin
case ({a,b,c,d})
4'b0000: F=1'b0;
4'b0001: F=1'b0;
4'b0010: F=1'b1;
4'b0011: F=1'b1;
4'b0100: F=1'b0;
4'b0101: F=1'b0;
4'b0110: F=1'b0;
4'b0111: F=1'b1;
4'b1000: F=1'b0;
4'b1001: F=1'b1;
4'b1010: F=1'b0;
4'b1011: F=1'b1;
4'b1100: F=1'b1;
4'b1101: F=1'b0;
4'b1110: F=1'b0;
4'b1111: F=1'b1;
endcase

end

//===============================
endmodule
// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps     
module Test_bench;
    // Inputs
    reg a ,b, c ,d;

    // Outputs
    wire F ;

    // Instantiate the Unit Under Test (UUT)
    // Ch5.3  F(a,b,c,d) circuit 
     EX10_2  UUT (
        .a(a), 
        .b(b), 
        .c(c), 
        .d(d),
        .F(F)
    );

    initial begin
        $monitor( a ,b, c, d, F);

        //Apply inputs
a=1'b0; b=1'b0; c=1'b0; d=1'b0;
        #100;
{a,b,c,d}=4'b0001;
        #100;
{a,b,c,d}=4'b0010;
        #100;
{a,b,c,d}=4'b0011;
        #100;
{a,b,c,d}=4'b0100;
        #100;
{a,b,c,d}=4'b0101;
        #100;
{a,b,c,d}=4'b0110;
        #100;
{a,b,c,d}=4'b0111;
        #100;
{a,b,c,d}=4'b1000;
        #100;
{a,b,c,d}=4'b1001;
        #100;
{a,b,c,d}=4'b1010;
        #100;
{a,b,c,d}=4'b1011;
        #100;
{a,b,c,d}=4'b1100;
        #100;
{a,b,c,d}=4'b1101;
        #100;
{a,b,c,d}=4'b1110;
        #100;
{a,b,c,d}=4'b1111;
        #100;
   
    end
    initial begin
#1600  $stop;
end
endmodule
//===============================

沒有留言:

張貼留言

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

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