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.

implementing equations

Status
Not open for further replies.

arunssn

Newbie level 2
Joined
Feb 10, 2006
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,305
how to implement equations in verilog that are synthesisable.
for eg |p0 - q0| etc.
 

if p0 and p1 are 1 bit wires...

wire out;

assign out = p0 + p1; // assigns to out their sum
assign out = p0 - p1; // difference
assign out = p0 ^ p1; // ^ means xor ,
// this is equal to |p0 - q0|

assign out = p0 && p1; // logical AND
assign out = p0 || p1; // logical OR
 

Code:
module eg(q0,q1,out);
parameter BW = 8;
input [BW-1:0] q0;
input [BW-1:0] q1;
output [BW-1:0] out;
assign out = (q0>q1)? (q0-q1) : (q1-q0);
enmodule
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top