Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F386634
substractor4.v
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Size
795 B
Referenced Files
None
Subscribers
None
substractor4.v
View Options
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
Details
Attached
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)
Attached To
Mode
R231 SoC_I-Edge_yosys_nem_optimization
Attached
Detach File
Event Timeline
Log In to Comment