Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F386514
divider1.v
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Size
909 B
Referenced Files
None
Subscribers
None
divider1.v
View Options
module
divider1
#(
parameter
BITWIDTH
=
1
)
(
A
,
B
,
Q
,
R
,
valid
);
// Input and Output Declarations
input
[
BITWIDTH
-
1
:
0
]
A
;
// A is the dividend
input
[
BITWIDTH
-
1
:
0
]
B
;
// B is the divisor
output
reg
[
BITWIDTH
-
1
:
0
]
Q
;
// Q is the quotient
output
reg
[
BITWIDTH
-
1
:
0
]
R
;
// R is the remainder
output
reg
valid
;
// Valid signal to indicate division is successful
// Division Process
always
@
*
begin
if
(
B
==
0
)
begin
Q
=
{
BITWIDTH
{
1
'
bx
}};
// Undefined if divisor is zero
R
=
{
BITWIDTH
{
1
'
bx
}};
// Undefined if divisor is zero
valid
=
0
;
// Invalid operation
end
else
begin
Q
=
A
/
B
;
// Calculate the quotient
R
=
A
%
B
;
// Calculate the remainder
valid
=
1
;
// Division is valid
end
end
endmodule
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 7:23 PM (13 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
157322
Default Alt Text
divider1.v (909 B)
Attached To
Mode
R231 SoC_I-Edge_yosys_nem_optimization
Attached
Detach File
Event Timeline
Log In to Comment