Jul 7, 2013 #1 S 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;
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;
Jul 8, 2013 #2 imbichie Full Member level 6 Joined Jul 30, 2010 Messages 381 Helped 55 Reputation 110 Reaction score 54 Trophy points 1,308 Location Cochin/ Kerala/ India or Bangalore/ Karnataka/ Ind Activity points 3,580 in VHDL the above thing will be like this Code: dat2 <= dat1(15 downto 13) & (not(dat1(12))) & dat1(11 downto 0);
in VHDL the above thing will be like this Code: dat2 <= dat1(15 downto 13) & (not(dat1(12))) & dat1(11 downto 0);
Jul 9, 2013 #3 D dave_59 Advanced Member level 3 Joined Dec 15, 2011 Messages 838 Helped 365 Reputation 734 Reaction score 360 Trophy points 1,353 Location Fremont, CA, USA Activity points 7,369 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]};
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]};