2020年3月1日 星期日

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


EX5-3 已知四變數布林函數 F(a, b, c, d) = abc′d′ + a′b′c + ab′c′d + 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
//===============================

沒有留言:

張貼留言

ESP32-Flutter-MQTT-IoT-Controller

 ESP32-Flutter-MQTT-IoT-Controller 這套系統包含了 Flutter 跨平台 App 、 ESP32 韌體 與 MQTT 雲端傳輸機制 。 專案中採用的 功能命名原則與對應關係 整理如下: 1. 核心功能名稱對照表 功能區塊 Python / ...