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.

how to extract bits in verilog

Status
Not open for further replies.

cutesue

Newbie level 5
Joined
Jan 14, 2012
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,338
i want to extract first four bits of an IP address,then next 4bits,then next 4 and so on in a 32bit IP address sequence...in verilog.how do i do that?
 

Hello,

You have to do an AND operation between the IP address and a mask and then shifts operations
Example:

If you need the first 4 bits you have to do (IP address) & (0x0000000F) without a shift
If you need the second group of 4 bits you have to do [ (IP address) & (0x000000F0)] >> 4
and so on...

Hope this helps.
 

can you pl tell me how to do this right shift in gate level.. shd i use an encoder?
 

If you are writing the program in verilog, the ">>" command does the right shift.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top