Apr 10, 2006 #1 sree205 Advanced Member level 1 Joined Mar 13, 2006 Messages 453 Helped 58 Reputation 116 Reaction score 25 Trophy points 1,308 Activity points 4,420 left shifting Hi, is this code the same as shifting to the left ? reg [7:0] a; always@(posedge clk) a <= {a[6:0],1'b0};
left shifting Hi, is this code the same as shifting to the left ? reg [7:0] a; always@(posedge clk) a <= {a[6:0],1'b0};
Apr 11, 2006 #2 T tarkyss Full Member level 6 Joined Aug 1, 2005 Messages 340 Helped 26 Reputation 52 Reaction score 8 Trophy points 1,298 Location China Activity points 4,162 left shifting yes, the fuction is the same, but the synthesis result maybe different.
Apr 12, 2006 #3 S sesl33 Junior Member level 1 Joined Apr 4, 2006 Messages 17 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,476 Re: left shifting sree205 said: Hi, is this code the same as shifting to the left ? reg [7:0] a; always@(posedge clk) a <= {a[6:0],1'b0}; Click to expand... This code also shift left: always @(posedge clk) a <= a << 1; Which code is more commonly used? and, why?
Re: left shifting sree205 said: Hi, is this code the same as shifting to the left ? reg [7:0] a; always@(posedge clk) a <= {a[6:0],1'b0}; Click to expand... This code also shift left: always @(posedge clk) a <= a << 1; Which code is more commonly used? and, why?
Apr 12, 2006 #4 Y yuenkit Advanced Member level 4 Joined Jan 20, 2005 Messages 107 Helped 6 Reputation 12 Reaction score 1 Trophy points 1,298 Activity points 1,047 left shifting a <= a << 1; is more common: it's more readable & intuitive. i believe the DC can generate a better circuit by this syntax. Added after 3 minutes: in other programing langauge, such as VB & C, concatenation operation will cause memory & runtime penalty. I guess it will cause the same effect on the simulation runtime & synthesis runtime as well
left shifting a <= a << 1; is more common: it's more readable & intuitive. i believe the DC can generate a better circuit by this syntax. Added after 3 minutes: in other programing langauge, such as VB & C, concatenation operation will cause memory & runtime penalty. I guess it will cause the same effect on the simulation runtime & synthesis runtime as well