![]() |
|
|
|
#1 |
|
Hello all,
I wondered if you could give me some insight into why the choices of a case statement must be locally static i.e. it can't be a generic value. Is there some workaround to still be able to generically specify the binary values of the states of my state machine (eg. to chosse a one-hot state machine when I implement the component) :My symphony compiler complains about this. -- JB Viviers jan |
|
|
|
|
#2 |
|
Posts: n/a
|
>I wondered if you could give me some insight into
>why the choices of a case statement must be >locally static i.e. it can't be a generic value. > >Is there some workaround to still be able to >generically specify the binary values of the >states of my state machine (eg. to chosse a one-hot >state machine when I implement the component) > Case choice must be locally static to protect the code from illegal choices. If the choice was globally static, then errors could occur. For example, assume a generic g of value 4, and a signal S declared as: signal S : std_logic_vector(g-1 downto 0); ... case S is when "0000" => ... when "0001" => ... when others => ... end case Now in the component instantiation or in a configuration, I set g to 32. The case choices are no longer valid. In a way, it protects the user from making dumb mistakes. ---------------------------------------------------------------------------- Ben Cohen Publisher, Trainer, Consultant (310) 721-4830 http://www.vhdlcohen.com/ Author of following textbooks: * Using PSL/SUGAR with Verilog and VHDL Guide to Property Specification Language for ABV, 2003 isbn 0-9705394-4-4 * Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 0-9705394-2-8 * Component Design by Example ", 2001 isbn 0-9705394-0-1 * VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn 0-7923-8474-1 * VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn 0-7923-8115 ------------------------------------------------------------------------------ VhdlCohen |
|
|
|
#3 |
|
Posts: n/a
|
jan a écrit:
> Hello all, > > I wondered if you could give me some insight into > why the choices of a case statement must be > locally static i.e. it can't be a generic value. > > Is there some workaround to still be able to > generically specify the binary values of the > states of my state machine (eg. to chosse a one-hot > state machine when I implement the component) Hi In the case of the state machine encoding, use an enumerated type for your state vector and then either let your synthesizer choose the encoding scheme or add some synthesis directives or attributes to specify the encoding scheme: type T_STATE is (IDLE, VALID, READ); signal STATE : T_STATE; attribute ENUM_ENCODING : string; -- attribute declaration attribute ENUM_ENCODING of T_STATE : type is “100 010 001”; Nicolas Nicolas Matringe |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cooler Master Gladiator 600 Case | Admin | Front Page News | 0 | 07-10-2009 10:52 AM |
| ThermalTake DH 102 Home Theater Case | Admin | Front Page News | 0 | 06-12-2009 08:22 AM |
| Lian Li Tyr PC-X500 Case Review | Admin | Front Page News | 0 | 07-11-2008 09:02 PM |
| Judge: File-swapping tools are legal | Citizen Bob | DVD Video | 140 | 11-08-2006 06:42 PM |
| Enermax Phoenix Case @ ThinkComputers.org | Silverstrand | Front Page News | 0 | 10-20-2006 12:28 PM |