FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-2010, 04:01 AM
rekz
Guest
 
Posts: n/a
Default getting least significant bits out of register

say I have the following:

reg[31:0] instruction;
reg[8:0] test;

and I want to assign test with the least 9 significant bits of the
register instruction, is there an easy way to do this using the assign?
Reply With Quote
  #2 (permalink)  
Old 02-04-2010, 04:08 AM
rekz
Guest
 
Posts: n/a
Default Re: getting least significant bits out of register

On Feb 3, 8:01*pm, rekz <aditya15...@gmail.com> wrote:
> say I have the following:
>
> reg[31:0] instruction;
> reg[8:0] test;
>
> and I want to assign test with the least 9 significant bits of the
> register instruction, is there an easy way to do this using the assign?


would the following does it:

assign test = instruction[7:0];
Reply With Quote
  #3 (permalink)  
Old 02-04-2010, 04:24 AM
David Rogoff
Guest
 
Posts: n/a
Default Re: getting least significant bits out of register

On 2010-02-03 19:01:50 -0800, rekz said:

> say I have the following:
>
> reg[31:0] instruction;
> reg[8:0] test;
>
> and I want to assign test with the least 9 significant bits of the
> register instruction, is there an easy way to do this using the assign?


This is getting ridiculous. You've been asking some very elementary
questions here and people have been trying to be helpful. However, this
is just too much. If you have read any book or introductory website on
Verilog you would know how to do this in the first 20 minutes. It's
really not reasonable for you to be asking people to take time to
explain these very simple Verilog concepts to you when you do appear to
have taken the time to study the language yourself. This newsgroup is
an excellent source of information from many engineers with years and
years of experience, but you need to do some work on your own, too.

David




Reply With Quote
  #4 (permalink)  
Old 02-04-2010, 04:42 AM
rekz
Guest
 
Posts: n/a
Default Re: getting least significant bits out of register

On Feb 3, 8:24*pm, David Rogoff <da...@therogoffs.com> wrote:
> On 2010-02-03 19:01:50 -0800, rekz said:
>
> > say I have the following:

>
> > reg[31:0] instruction;
> > reg[8:0] test;

>
> > and I want to assign test with the least 9 significant bits of the
> > register instruction, is there an easy way to do this using the assign?

>
> This is getting ridiculous. *You've been asking some very elementary
> questions here and people have been trying to be helpful. However, this
> is just too much. *If you have read any book or introductory website on
> Verilog you would know how to do this in the first 20 minutes. * It's
> really not reasonable for you to be asking people to take time to
> explain these very simple Verilog concepts to you when you do appear to
> have taken the time to study the language yourself. *This newsgroup is
> an excellent source of information from many engineers with years and
> years of experience, but you need to do some work on your own, too.
>
> *David


I've read some resources and that seems to be the way to do it.... I
just want to know if it's right
Reply With Quote
  #5 (permalink)  
Old 02-04-2010, 06:03 PM
Cary R.
Guest
 
Posts: n/a
Default Re: getting least significant bits out of register

rekz wrote:
> On Feb 3, 8:01 pm, rekz <aditya15...@gmail.com> wrote:
>> say I have the following:
>>
>> reg[31:0] instruction;
>> reg[8:0] test;
>>
>> and I want to assign test with the least 9 significant bits of the
>> register instruction, is there an easy way to do this using the assign?

>
> would the following does it:
>
> assign test = instruction[7:0];


No, this does not assign the nine least significant bit of instruction
to test. I'll leave finding the error as an exercise for the OP.

Like others have said learning how to experiment with the language and
how to debug your design are critical skills that must be learned if you
want to be successful! Sometimes this can be painful, but it cannot be
learned by someone else telling you the answer.

Cary
Reply With Quote
  #6 (permalink)  
Old 02-04-2010, 06:04 PM
gabor
Guest
 
Posts: n/a
Default Re: getting least significant bits out of register

On Feb 3, 10:08*pm, rekz <aditya15...@gmail.com> wrote:
> On Feb 3, 8:01*pm, rekz <aditya15...@gmail.com> wrote:
>
> > say I have the following:

>
> > reg[31:0] instruction;
> > reg[8:0] test;

>
> > and I want to assign test with the least 9 significant bits of the
> > register instruction, is there an easy way to do this using the assign?

>
> would the following does it:
>
> assign test = instruction[7:0];


Questions for you. . .

Why would you think instruction[7:0] would supply the least
significant "9 bits"?

What would this do?

assign test = instruction;

Regards,
Gabor
Reply With Quote
  #7 (permalink)  
Old 02-09-2010, 11:07 PM
LittleAlex
Guest
 
Posts: n/a
Default Re: getting least significant bits out of register

On Feb 4, 9:04*am, gabor <ga...@alacron.com> wrote:
> On Feb 3, 10:08*pm, rekz <aditya15...@gmail.com> wrote:
>
> > On Feb 3, 8:01*pm, rekz <aditya15...@gmail.com> wrote:

>
> > > say I have the following:

>
> > > reg[31:0] instruction;
> > > reg[8:0] test;

>
> > > and I want to assign test with the least 9 significant bits of the
> > > register instruction, is there an easy way to do this using the assign?

>
> > would the following does it:

>
> > assign test = instruction[7:0];

>
> Questions for you. . .
>
> Why would you think instruction[7:0] would supply the least
> significant "9 bits"?
>
> What would this do?
>
> assign test = instruction;
>
> Regards,
> Gabor


How does one decide which bits of an instruction are significant? And
isn't it subjective which bits are more significant? For example, I
could contend that an addressing mode bit was more important than the
address portion, but others contend that the arithmetic selection bits
were more significant.

Frustrated by Xilinx's UCF syntax and looking for diversion,
AL.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spartan 6 migration whitepaper points out some significant changes Gabor FPGA 0 11-20-2009 03:18 PM
How to get most significant bits qharz VHDL 2 06-23-2009 10:23 PM
passing status register bits Marco VHDL 6 08-25-2006 10:57 PM
Significant periods in Periodogram (threshold) Michalis DSP 1 09-08-2004 06:54 AM
Altera Stratix 80: How to divide a bits stream to even bits streamand odd bits stream zhao FPGA 1 12-16-2003 06:45 PM


All times are GMT +1. The time now is 03:38 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved