one_hot_shifter.vhd
Example Voice Commands:

The below sequence of shifts a single bit to the left every 1 micro seconds and moves it 4 positions then restarts. The bit starts as the right most bit "00001" and then shift left... "00010", "00100", "01000" ect.

"restart from scratch" "configure counter zero" "count one micro-seconds" "index one" "count five" "chain" "shift left" "data hex one" "count counter one value" "ok"

Simulation Results:
Usage Discussion:

The initial value that is passed into the SHIFT_DATA_LEFT procedure is a hard coded 'hex 1'. Two general purpose counters (counter 0 and counter 1) are chained together to create the time interval. The 'value' of counter 1 is used as input to the SHIFT_DATA_LEFT procedure call. This pattern can be delayed to a longer time period (say one second) and used to possibly drive LED. The 1 us is used for simulation purposes.

Note
Other Options Exist

This example shows the use of two chained counters to create a time base. However, using a 'delay' counter configured by the TIME_COUNTER procedure call would have been the most appropriate choice for this application. Counting functionality provided by CONFIGURE_COUNTER, TIME_COUNTER and ACTION_TRANSITION provide some overlap by design. Either method is fine to use in this application.

VHDL Code Generated:
1library ieee;
2use ieee.std_logic_1164.all;
3use ieee.numeric_std.all;
4use ieee.std_logic_unsigned.all;
5use work.user_defs_pkg.all;
6use work.sm_api_pkg.all;
7
8--=======================================================================================================
9entity one_hot_shifter is
10
11 generic (this_sm : integer := -1);
12 port (
13 clk : in std_logic;
14 reset : in std_logic;
15 sm_input : in std_logic_vector(-1 downto 0);
16 sm_output : out std_logic_vector(-1 downto 0);
17 sm_io : inout std_logic_vector(-1 downto 0);
18 next_state_rec : out nsr_array (0 to 0);
19 state_reg_rec : in srr_array (0 to 0)
20
21 );
22
23end entity one_hot_shifter;
24--=======================================================================================================
25
26architecture arch of one_hot_shifter is
27
28 alias srr is state_reg_rec(0);
29 alias state_reg : integer is state_reg_rec(0).state_reg;
30
31begin
32
33process(state_reg_rec)
34
35begin
36
37 --===========================================================================================
38 --=============================ACTIVE RESOURCE 0 (of 0) state -1============================
39 RESOURCE_SELECT( sys_clk, next_state_rec, state_reg_rec );
40 CONFIGURE_COUNTER( 0, us(1), -1, next_state_rec, state_reg_rec );
41 CONFIGURE_COUNTER( 1, 5, -1, next_state_rec, state_reg_rec, chain );
42 --===========================================================================================
43 SHIFT_DATA_LEFT( x"1", srr.counter(1).value, next_state_rec, state_reg_rec );
44 --===========================================================================================
45 --===========================================================================================
46
47end process;
48
49end architecture arch;
50--=======================================================================================================