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; endendmodule
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