shaiko
Advanced Member level 5
- Joined
- Aug 20, 2011
- Messages
- 2,644
- Helped
- 303
- Reputation
- 608
- Reaction score
- 297
- Trophy points
- 1,363
- Activity points
- 18,302
In VHDL, what is the reseved word "register" used for ?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Per the LRM...In VHDL, what is the reseved word "register" used for ?
For the cases where I just want to register some signal, I like this method...simple and concise.IIRC, it was meant to allow you to implement a register without a process.
BTW,
Is there ever going to be any support for VHDL 2008 by synthesis tools ?
There is a difference when you have multiple processes driving the same signal.Run of the mill signal assignments retain their last value until they hit a new assignment...so what exactly a 'guarded register signal' or a 'guarded bus signal' brings to the table as far as being a better way to write code isn't very obvious...if it's not better, don't bother with it.
There is a difference when you have multiple processes driving the same signal.
When all processes drives a normal std_logic signal with 'Z', the result is 'Z'.
When all drivers disconnect from a "register" signal, the previous resolved value is kept.
This kept value can be '0', '1', 'Z' or whatever.
It is not the same. For a normal signal each driver keeps it's own value. A "register" signal keeps a value by itself when all drivers are disconnected.This is exactly the same behaviour as your 'normal' signal assignment. The value that is 'kept' for the signal is simply the last value driven, whether that assignment comes from a 'guarded' signal assignment or a 'non-guarded' assignment. If that last assignment is '0', the signal will be '0', if it's 'Z' it will be 'Z'.
A guarded std_logic is similar to a normal std_logic with an extra "weak" driver, which only has effect when all other drivers are driving 'Z'.K-J said:From the LRM's perspective, I don't think the phrase "all of its drivers are turned off" has the same meaning as it would be from an electrical perspective where it would typically mean that all drivers are tri-stated. Just using normal signal assignments, every process that connects to a signal is always driving that signal with something. The resolution function is what takes all of those driving values and determines the final driven value for the signal.
I agree, it is not the same thing. If all drivers drive a normal signal to 'Z', the result will be 'Z'.K-J said:Besides, driving a signal to a value of 'Z' can't mean the same thing as 'all of its drivers are turned off' because the phrase 'all of its drivers are turned off' is part of the language definition itself where as type std_logic/std_ulogic which defines 'Z' with the meaning used for a tri-state is defined in the std_logic_1164 package. That package depends on the LRM, the LRM does not depend on that package.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 library ieee; use ieee.std_logic_1164.all; entity test_guarded_signals is end test_guarded_signals; architecture sim of test_guarded_signals is signal test_guarded_register : std_logic register; signal test_guarded_bus : std_logic bus; signal driving_0 : std_logic := '0'; signal driving_1 : std_logic := '0'; begin -- process for setting bits process begin wait for 5 us; test_guarded_register <= '1'; test_guarded_bus <= '1'; driving_1 <= '1'; wait for 1 us; test_guarded_register <= null; -- A null assignment disconnects the driver test_guarded_bus <= null; driving_1 <= '0'; wait for 10 us; test_guarded_register <= '1'; test_guarded_bus <= '1'; driving_1 <= '1'; wait for 1 us; test_guarded_register <= null; test_guarded_bus <= null; driving_1 <= '0'; wait for 1 us; wait; end process; -- process for clearing bits process begin test_guarded_register <= null; test_guarded_bus <= null; wait for 10 us; test_guarded_register <= '0'; test_guarded_bus <= '0'; driving_0 <= '1'; wait for 1 us; test_guarded_register <= null; test_guarded_bus <= null; driving_0 <= '0'; wait; end process; end sim;