quest4tech.net |
|
Data defined as: | address : in STD_LOGIC_VECTOR(8 DOWNTO 0); |
Solution: |
VARIABLE address_int : INTEGER 0 to 255;
address_int := CONV_INTEGER(UNSIGNED(address)); |
Application: | array(address_int) := data; -- example of addressing an array. |
Data defined as: |
data_out : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
VARIABLE cnt : INTEGER; -- internal count. |
Solution: |
cnt := cnt + 1; -- e.g. incremented every clock pulse.
data_out <= CONV_STD_LOGIC_VECTOR(cnt,24); |
I/O Data as: |
data_in : IN STD_LOGIC_VECTOR(23 downto 0);
data_out : OUT STD_LOGIC_VECTOR(23 downto 0); |
Solution: |
SIGNAL d; : UNSIGNED (23 DOWNTO 0); -- internal signals
SIGNAL q; : UNSIGNED (23 DOWNTO 0); -- for data type conversions. CONSTANT one : UNSIGNED(23 downto 0) := ( 0=>'1', others=>'0'); -- define 000001h. |
(in process:) |
d <= UNSIGNED(data_in); -- internal data type conversion.
data_out <= STD_LOGIC_VECTOR(q); q <= d + one; -- arithmetic operation. |
In the architecture section set:- | SIGNAL time2accum_ram_a : BOOLEAN := FALSE; |
In the main section set:- | time2accum_ram_a <= FALSE, TRUE AFTER 56.5 us; |
In a process use:- | WAIT UNTIL time2accum_ram_a = TRUE; |
|
(c) Compiled by B V Wood. |