-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSubtractor_8_bit_tb.v
49 lines (42 loc) · 985 Bytes
/
Subtractor_8_bit_tb.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13.07.2023 01:13:18
// Design Name:
// Module Name: Subtractor_8_bit_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module Subtractor_8_bit_tb();
reg [7:0]A,B;
reg borrow_in;
wire [7:0]diff;
wire borrow_out;
reg clk;
Subtractor_8_bit SUB(.diff(diff),.borrow_out(borrow_out),.A(A),.B(B));
//Chat gpt
// Testbench code
initial begin
// Initialize inputs
A = 8'b10101010;
B = 8'b01010101;
// Toggle clock every 10 time units
clk = 0;
forever #5 clk = ~clk;
end
// Monitor the difference output
always @(posedge clk) begin
$display("Difference = %b", diff);
end
endmodule