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.

[SOLVED] not (~) a single bit in an array in verilog

Status
Not open for further replies.

sobella1923

Newbie level 4
Joined
Jun 17, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
43
im need to take a not of a single bit in a array of 16.

input [15:0] dat1 =16'b0000001000000001;

what i need is

output [15:0]dat2=16'b0001001000000001;
 

There are several ways you could do this

One way is

Code:
always @dat1 begin
               dat2 = dat1;
               dat2[12] = ~ dat1[12];
          end
Even though you assign dat2[12] twice, only the last assignment wins. Synthesis tools only synthesize the last assignment.

You could also do

Code:
assign dat2 = {dat1[15:13], ~dat1[12], dat1[11:0]};
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top