Newbie Question

  • Thread starter jjlindula@hotmail.com
  • Start date
J

jjlindula@hotmail.com

Guest
Hello, I am a newbie and have a quick question for anyone. Can someone
explain:

{ 7 - (0) + 1{1'b0}}


I know it should be an 8 bit vector but don't understand how it gets 8
bits.

Thanks,
joe
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jjlindula@hotmail.com wrote:
Hello, I am a newbie and have a quick question for anyone. Can someone
explain:

{ 7 - (0) + 1{1'b0}}


I know it should be an 8 bit vector but don't understand how it gets 8
bits.
Perhaps if you arranged the parentheses differently?

{ (7-(0)+1){1'b0}}

That is a repeat concatenation. The value in front of the inner {}
is telling the compiler to repeat the inside of the {} that number
of times. In your example, (7-0+1) is 8, so {8{1'b0}} is 1'b0
repeated 8 times.

- --
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFH3+w7rPt1Sc2b3ikRAsiVAKDSIUlbGm/n/R5ukjzPbY/J6mBXnACfbXhr
m4Jf1fVue+YfskWNngF5oSM=
=K1es
-----END PGP SIGNATURE-----
 
On Mar 18, 8:34 am, "jjlind...@hotmail.com" <jjlind...@hotmail.com>
wrote:
Hello, I am a newbie and have a quick question for anyone. Can someone
explain:

{ 7 - (0) + 1{1'b0}}

I know it should be an 8 bit vector but don't understand how it gets 8
bits.

Thanks,
joe
Are you not including some information?
The native size of this operation in most systems I'm aware of is 32
bits thanks to the unsized integer.
 
On Mar 18, 9:22 am, Stephen Williams <spamt...@icarus.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jjlind...@hotmail.com wrote:
Hello, I am a newbie and have a quick question for anyone. Can someone
explain:

{ 7 - (0) + 1{1'b0}}

I know it should be an 8 bit vector but don't understand how it gets 8
bits.

Perhaps if you arranged the parentheses differently?

   { (7-(0)+1){1'b0}}

That is a repeat concatenation. The value in front of the inner {}
is telling the compiler to repeat the inside of the {} that number
of times. In your example, (7-0+1) is 8, so {8{1'b0}} is 1'b0
repeated 8 times.

- --
Steve Williams                "The woods are lovely, dark and deep.
steve at icarus.com           But I have promises to keep,http://www.icarus.com        and lines to code before I sleep,http://www.picturel.com      And lines to code before I sleep."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE -http://enigmail.mozdev.org

iD8DBQFH3+w7rPt1Sc2b3ikRAsiVAKDSIUlbGm/n/R5ukjzPbY/J6mBXnACfbXhr
m4Jf1fVue+YfskWNngF5oSM> =K1es
-----END PGP SIGNATURE-----
Does the LRM suggest the paranthesis you showed *are* implied?
1{1'b0} isn't a concatenation or a replication. Since there's no
comma before {1'b0} is the replication arguement directly implied?

I was incorrectly thinking the 1{1'b0} was a replication but it's not,
of course, without the outside pair of brackets.

Bottom line for me: please don't ever use the original style - always
use parenthesis.
 
On Mar 18, 8:37 am, John_H <newsgr...@johnhandwork.com> wrote:
On Mar 18, 9:22 am, Stephen Williams <spamt...@icarus.com> wrote:



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jjlind...@hotmail.com wrote:
Hello, I am a newbie and have a quick question for anyone. Can someone
explain:

{ 7 - (0) + 1{1'b0}}

I know it should be an 8 bit vector but don't understand how it gets 8
bits.

Perhaps if you arranged the parentheses differently?

{ (7-(0)+1){1'b0}}

That is a repeat concatenation. The value in front of the inner {}
is telling the compiler to repeat the inside of the {} that number
of times. In your example, (7-0+1) is 8, so {8{1'b0}} is 1'b0
repeated 8 times.

- --
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,http://www.icarus.com and lines to code before I sleep,http://www.picturel.com And lines to code before I sleep."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE -http://enigmail.mozdev.org

iD8DBQFH3+w7rPt1Sc2b3ikRAsiVAKDSIUlbGm/n/R5ukjzPbY/J6mBXnACfbXhr
m4Jf1fVue+YfskWNngF5oSM=
=K1es
-----END PGP SIGNATURE-----

Does the LRM suggest the paranthesis you showed *are* implied?
1{1'b0} isn't a concatenation or a replication. Since there's no
comma before {1'b0} is the replication arguement directly implied?

I was incorrectly thinking the 1{1'b0} was a replication but it's not,
of course, without the outside pair of brackets.

Bottom line for me: please don't ever use the original style - always
use parenthesis.
Hello, the complete line is:

// define sram write enable
assign sram_be = ((slv_bar[2]) == 1'b1 & slv_write == 1'b1) ?
slv_bytevalid : {7-(0)+1{1'b0}} ;

The sram_be and slv_bytevalid are 8 bit vectors. Does this help.

Thanks for all you help.
 
On Mar 18, 9:34 am, "jjlind...@hotmail.com" <jjlind...@hotmail.com>
wrote:
On Mar 18, 8:37 am, John_H <newsgr...@johnhandwork.com> wrote:



On Mar 18, 9:22 am, Stephen Williams <spamt...@icarus.com> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jjlind...@hotmail.com wrote:
Hello, I am a newbie and have a quick question for anyone. Can someone
explain:

{ 7 - (0) + 1{1'b0}}

I know it should be an 8 bit vector but don't understand how it gets 8
bits.

Perhaps if you arranged the parentheses differently?

{ (7-(0)+1){1'b0}}

That is a repeat concatenation. The value in front of the inner {}
is telling the compiler to repeat the inside of the {} that number
of times. In your example, (7-0+1) is 8, so {8{1'b0}} is 1'b0
repeated 8 times.

- --
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,http://www.icarus.com and lines to code before I sleep,http://www.picturel.com And lines to code before I sleep."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE -http://enigmail.mozdev.org

iD8DBQFH3+w7rPt1Sc2b3ikRAsiVAKDSIUlbGm/n/R5ukjzPbY/J6mBXnACfbXhr
m4Jf1fVue+YfskWNngF5oSM=
=K1es
-----END PGP SIGNATURE-----

Does the LRM suggest the paranthesis you showed *are* implied?
1{1'b0} isn't a concatenation or a replication. Since there's no
comma before {1'b0} is the replication arguement directly implied?

I was incorrectly thinking the 1{1'b0} was a replication but it's not,
of course, without the outside pair of brackets.

Bottom line for me: please don't ever use the original style - always
use parenthesis.

Hello, the complete line is:

// define sram write enable
assign sram_be = ((slv_bar[2]) == 1'b1 & slv_write == 1'b1) ?
slv_bytevalid : {7-(0)+1{1'b0}} ;

The sram_be and slv_bytevalid are 8 bit vectors. Does this help.

Thanks for all you help.
Thanks everyone for responding to my post. It is simply 8'b0, any
thoughts why they chose to make it complex?

Thanks,
joe
 
On Mar 18, 11:42 am, "jjlind...@hotmail.com" <jjlind...@hotmail.com>
wrote:
Thanks everyone for responding to my post. It is simply 8'b0, any
thoughts why they chose to make it complex?

Thanks,
joe
It's only your example that's complex. I do not recommend that you
code your replication values in the same way it's shown in your
example. I would criticize any engineer that produced code like that
which might ever be seen by anyone but the author; even then, it's bad
for the author after a few months away from the code.

It should always be obvious what the code is trying to do. While
syntactically valid (it seems) the syntax in your example is too
easily confused and should - as a matter of style - include the
parenthesis in a situation like this.
 
On Tue, 18 Mar 2008 12:15:14 -0700 (PDT), John_H
<newsgroup@johnhandwork.com> wrote:

On Mar 18, 11:42 am, "jjlind...@hotmail.com" <jjlind...@hotmail.com
wrote:

Thanks everyone for responding to my post. It is simply 8'b0, any
thoughts why they chose to make it complex?

Thanks,
joe

It's only your example that's complex. I do not recommend that you
code your replication values in the same way it's shown in your
example.
I'd suggest that the code was perhaps created by some
automated preprocessor. The "slv" in your signal names
suggests that this might be the result of some kind of
automated translation from VHDL. If so, the weird
expression
7 - (0) + 1
could easily have come from a preprocessor via something
like
length = upper_bound - lower_bound + 1

Automatic translation might also explain the bizarre
parentheses around the zero, although in that case I
would have expected to see them around the "7" as well.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top