Page MenuHomePhorge

substractor4.v
No OneTemporary

Size
795 B
Referenced Files
None
Subscribers
None

substractor4.v

module substractor4 #(parameter BITWIDTH = 4) (A, B, Ci, S, Co);
// Input and Output Declarations
input [BITWIDTH-1:0] A; // A is an input of size BITWIDTH
input [BITWIDTH-1:0] B; // B is an input of size BITWIDTH
input Ci; // Carry-in (used for borrow)
output [BITWIDTH-1:0] S; // S is an output of size BITWIDTH
output Co; // Carry-out (borrow-out)
// Internal Wire Declaration
wire [BITWIDTH:0] Diff; // Difference wire (one extra bit for borrow)
// Assign Statements for Subtraction
assign Diff = A - B - Ci; // Calculate the difference
assign S = Diff[BITWIDTH-1:0]; // Assign the lower BITWIDTH bits to S
assign Co = Diff[BITWIDTH]; // Assign the borrow-out
endmodule

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 4, 1:02 AM (11 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
157419
Default Alt Text
substractor4.v (795 B)

Event Timeline