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.

Problem in using mod operator

Status
Not open for further replies.

Mkanimozhi

Full Member level 4
Joined
Aug 8, 2007
Messages
193
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
3,445
using mod operator

Hi to every one,
When i use the power operator and mod operator in my program , mpower always calculating as a zero value why? plz some one tell me the solution.

module power_mod(a,b);
input[15:0] a;
output b;

parameter base =2;
parameter exponent =5;
wire value;
wire mod;
assign value = base ** 5;
assign mod= a % value;
assign b=mod;
endmodule


regards
kanimozhi
 

Hi Kanimozhi,

u r code looks like this :
parameter base =2;
wire value;
assign value = base ** 5;

value will be 32 since base is 2, if u represent 32 in binary it will be 6'b100000 and u have declared "value" as wire which means it will take the lsb i.e 0

Try to declare "value" to u r desired bus size depending up on how large it can be.

Regards,
dcreddy
 

    Mkanimozhi

    Points: 2
    Helpful Answer Positive Rating
thank u ya, my problem got over, i have declared value as a single bot wire, i have changed into my desired bit length .
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top