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.

why the same division has different result?

Status
Not open for further replies.

clould365

Newbie level 4
Joined
Apr 30, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,309
There are two different expression
1.reg baud_rate=3;
wire [15:0] one_bit_clock_nums;
assign one_bit_clock_nums =2083/(2^baud_rate);
2.assign one_bit_clock_nums =2083/8;

In ModelSim,
the result are
1.2083
2.260

what's the reason?
BTW,Is division Synthesizable?
 

2^3 = 1

like in C, "^" is "xor".
 

Indeed. You probably think 2^a is taking the a power of 2. Which it isn't. As permute said the ^ operator is XOR.

If you want 2 to the power of something, you can use (2 << a). Also very much like C. ;)
 

Sorry ,I know my fault,so stupid I am
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top