EmbDev.net

Forum: FPGA, VHDL & Verilog part of a reg as statmeant in case


von shmulik (Guest)


Rate this post
useful
not useful
hi all,
can i use part of a bus as statement in case?

for an example:
case ( work_plan(2:0) )
     00 :

and etc'

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Give it a try...

von shmulik (Guest)


Rate this post
useful
not useful
well it not wroking for me, so i meant, how should i write it ? should i 
declare a new reg ?

von Lattice User (Guest)


Rate this post
useful
not useful
shmulik wrote:
> hi all,
> can i use part of a bus as statement in case?
>
> for an example:
> case ( work_plan(2:0) )
>      00 :
>
> and etc'

This should work.
If there is something wrong, it is outside the sample.

von shmulik (Guest)


Rate this post
useful
not useful
i wrote :
always @ ( slsrc or sldet )
  begin
    case ( work_plan(2:0) )
      APB_SLAVE1    :
        sone_addr  = sldst;
        sone_we    = 1111;
        sone_wdata  = prdata;


and this is the massge i recive when trying to compile:

...(165): near ":": syntax error, unexpected ':', expecting ')'.

when i deleted it, and wrote:

always @ ( slsrc or sldet )
  begin

    case ( work_plan )
      APB_SLAVE1    :
        sone_addr  = sldst;
        sone_we    = 1111;
        sone_wdata  = prdata;

i recive no error.

von Lattice User (Guest)


Rate this post
useful
not useful
Sorry i overlooked a fundamental error in your sample
You need to use square brackets!

von shmulik (Guest)


Rate this post
useful
not useful
lol its working, how i didn't see that ?!?!
thanks very much !!!!!!!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.