Xilinx ISE软件 模拟组合逻辑入门 4位加法器

testhello.v


`timescale 1ns / 1ps

//
// Company: 
// Engineer: 
// 
// Create Date:    10:21:36 05/06/2017 
// Design Name: 
// Module Name:    testhello 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//
module testhello(C0,A,B,C1,S);
    input C0;
input [3:0]A;
input [3:0]B;
output C1;
output [3:0]S;
reg[3:0]S;
reg C1;
 
always @(A or B or C0)
    begin
      S = A + B + C0;
      if(A + B + C0 > 15 )
   C1 = 1;
else
   C1=0;
    end

endmodule



test_testhello.v

`timescale 1ns / 1ps



// Company: 
// Engineer:
//
// Create Date:   10:28:39 05/06/2017
// Design Name:   testhello
// Module Name:   D:/ise147/prj/testhello/test_testhello.v
// Project Name:  testhello
// Target Device:  
// Tool versions:  
// Description: 
//
// Verilog Test Fixture created by ISE for module: testhello
//
// Dependencies:
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 



module test_testhello;


// Inputs
reg C0;
reg [3:0] A;
reg [3:0] B;


// Outputs
wire C1;
wire [3:0] S;


// Instantiate the Unit Under Test (UUT)
testhello uut (
.C0(C0), 
.A(A), 
.B(B), 
.C1(C1), 
.S(S)
);


initial begin
// Initialize Inputs
C0 = 0;
A = 0;
B = 0;


// Wait 100 ns for global reset to finish
#100;
C0 = 0;
A = 4'b0001;
B = 4'b0100;
      #100;

A = 4'b0001;
B = 4'b1111;
      #100;
        
// Add stimulus here


end
      
endmodule



  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值