Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"Even if you're on the right track, you'll get run over if you just sit there." -- Will Rogers


devel / comp.lang.vhdl / Re: Converting Signed (or unsigned) to TO_INTEGER

SubjectAuthor
o Converting Signed (or unsigned) to TO_INTEGERKJ

1
Re: Converting Signed (or unsigned) to TO_INTEGER

<84845d7a-3232-4bf8-ac3f-d5aa5580a47bn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=97&group=comp.lang.vhdl#97

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:6214:9a1:b0:56c:1704:b11c with SMTP id du1-20020a05621409a100b0056c1704b11cmr4593389qvb.7.1679013234782;
Thu, 16 Mar 2023 17:33:54 -0700 (PDT)
X-Received: by 2002:a81:e24c:0:b0:541:7f69:aa9b with SMTP id
z12-20020a81e24c000000b005417f69aa9bmr288971ywl.4.1679013234469; Thu, 16 Mar
2023 17:33:54 -0700 (PDT)
Path: rocksolid2!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Thu, 16 Mar 2023 17:33:54 -0700 (PDT)
In-Reply-To: <7c58ea4f-d2f7-4d24-8838-5476ee4ffaf0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:d660:9640:9535:80b8:c71a:9192;
posting-account=TJOePQoAAADr-f6dDt_fMmacSJMCG-pd
NNTP-Posting-Host: 2600:1700:d660:9640:9535:80b8:c71a:9192
References: <7c58ea4f-d2f7-4d24-8838-5476ee4ffaf0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <84845d7a-3232-4bf8-ac3f-d5aa5580a47bn@googlegroups.com>
Subject: Re: Converting Signed (or unsigned) to TO_INTEGER
From: kkjennings@sbcglobal.net (KJ)
Injection-Date: Fri, 17 Mar 2023 00:33:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2254
 by: KJ - Fri, 17 Mar 2023 00:33 UTC

On Thursday, March 16, 2023 at 12:16:09 PM UTC-4, A “Ashvin” wrote:
> I have the following declarations
>
> signal S: SIGNED(7 downto 0);
> signal N: INTEGER;
>
> N <= TO_INTEGER(S);
>
> Question: Will the TO_INTEGER functiona sign extend 'S' to 32 bit integer?
>
> Thanks.

VHDL integers are not a collection of 'bits' so in that sense the answer to your question is 'No'. However, if you assign S <= "11111111"; then N will be set to -1 in your example. I assume this is more along the lines of the real question you are getting at. Commonly, VHDL integers are implemented as either 32 or 64 bits.

If you have access to a VHDL simulator, it seems like you could have answered this question yourself with about the same amount of effort you put into your post...is there a reason you didn't? Or do you not have access to a VHDL simulator? If not, I suggest at least GHDL which is free for download..

Kevin Jennings

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor