(有代码)基于某libero的数字逻辑设计仿真及验证实验(4-8) 联系客服

发布时间 : 星期三 文章(有代码)基于某libero的数字逻辑设计仿真及验证实验(4-8)更新完毕开始阅读c911529e24fff705cc1755270722192e453658d3

标准

B=0;

repeat(20)

#20 B=$random; end initial begin C0=0; repeat(20)

#20 C0=$random; end initial begin C1=0; repeat(20)

#20 C1=$random; end initial begin C2=0; repeat(20)

#20 C2=$random; end initial begin C3=0; repeat(20)

#20 C3=$random; end

HC153 u153 (

.C0 (C0), .C1 (C1), .C2 (C2), .C3 (C3), .G (G), .A (A), .B (B), .Y (Y) );

endmodule

//74HC85代码 //HC85.v

module HC85(A3,A2,A1,A0,B3,B2,B1,B0,QAGB,QASB,QAEB,IAGB,IASB,IAEB);

文案

标准

input A3,A2,A1,A0,B3,B2,B1,B0,IAGB,IASB,IAEB; output QAGB,QASB,QAEB; reg QAGB,QASB,QAEB; wire [3:0]DataA,DataB; assign DataA[0]=A0; assign DataA[1]=A1; assign DataA[2]=A2; assign DataA[3]=A3; assign DataB[0]=B0; assign DataB[1]=B1; assign DataB[2]=B2; assign DataB[3]=B3;

always @(DataA or DataB) begin

if(DataA>DataB) begin

QAGB=1;QASB=0;QAEB=0; end

else if(DataA

QASB=1;QAGB=0;QAEB=0; end

else if(IAGB&!IASB&!IAEB) begin

QAGB=1;QASB=0;QAEB=0; end

else if(!IAGB&IASB&!IAEB) begin

QASB=1;QAGB=0;QAEB=0; end

else if(IAEB) begin

QAEB=1;QASB=0;QAGB=0; end begin

if(DataA==DataB)

if(IAGB&IASB&!IAEB)

begin QAGB=0;QASB=0;QAEB=0;end if(!IAGB&!IASB&!IAEB)

begin QAGB=1;QASB=1;QAEB=0;end end end

endmodule

//74HC85测试平台代码

文案

标准

// test85.v

`timescale 1ns/1ns module test85;

reg A3,A2,A1,A0,B3,B2,B1,B0; reg IAGB,IASB,IAEB; wire QAGB,QASB,QAEB; initial begin A3=0; repeat(20)

#20 A3=$random; end initial begin A2=0; repeat(20)

#20 A2=$random; end initial begin A1=0; repeat(20)

#20 A1=$random; end initial begin A0=0; repeat(20)

#20 A0=$random; end initial begin B3=0; repeat(20)

#20 B3=$random; end initial begin B2=0; repeat(20)

#20 B2=$random; end initial begin

文案

标准

B1=0; repeat(20)

#20 B1=$random; end initial begin B0=0; repeat(20)

#20 B0=$random; end initial begin IAGB=0; repeat(10)

#40 IAGB=$random; end initial begin IASB=0; repeat(10)

#40 IASB=$random; end initial begin IAEB=0; repeat(10)

#40 IAEB=$random; end

HC85 u85 (

.A3 (A3), .A2 (A2), .A1 (A1), .A0 (A0), .B3 (B3), .B2 (B2), .B1 (B1), .B0 (B0),

.IAGB (IAGB), .IASB (IASB), .IAEB (IAEB), .QAGB (QAGB), .QASB (QASB), .QAEB (QAEB)

文案