Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog2001 $signed question

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
Hi all,

How can I multiply a signed operand with a unsigned operand?

Code:
input [7:0] a;
input signed [7:0] b;
output signed [15:0] z;

Code:
assign z = $signed({1'b0,a}) * b;

or

Code:
assign z = $signed(a) * b;

And why?

Thanks!
Davy
 

the first one is correct, if a[7] can be sign bit the second one is also ok.
 

Without $signed(a), the result z will be $unsigned even though b is signed.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top