Motion FPGA
Motion FPGA for the MachX02-7000HE Breakout Board
sim_step_counter.vhd
Go to the documentation of this file.
1
-------------------------------------------------------------------------------
2
--! @file
3
--! @brief Step counter module
4
-------------------------------------------------------------------------------
5
6
--! Using IEEE library
7
LIBRARY
ieee
;
8
9
--! Using IEEE standard logic components
10
USE
ieee
.std_logic_1164.
ALL
;
11
12
--! Using IEE standard numeric components
13
USE
ieee
.numeric_std.
ALL
;
14
15
--! @brief Entity to count steps
16
ENTITY
sim_step_counter
IS
17
PORT
(
18
rst_in
:
IN
std_logic
;
--! Asynchronous reset
19
step_in
:
IN
std_logic
;
--! Step input
20
dir_in
:
IN
std_logic
;
--! Direction
21
size_in
:
IN
integer
;
--! Size of steps
22
steps_out
:
OUT
integer
--! Current steps
23
)
;
24
END
ENTITY
sim_step_counter
;
25
26
--! Architecture sim of entity sim_step_counter
27
ARCHITECTURE
sim
OF
sim_step_counter
IS
28
29
--! Current step count
30
SIGNAL
steps
:
integer
;
31
32
BEGIN
33
34
--! @brief Process to count steps
35
pr_count :
PROCESS
(
rst_in
,
step_in
)
IS
36
BEGIN
37
38
IF
(
rst_in
=
'
1
'
)
THEN
39
-- Reset state
40
steps
<=
0
;
41
ELSIF
(
rising_edge
(
step_in
)
)
THEN
42
-- Count steps
43
IF
(
dir_in
=
'
0
'
)
THEN
44
steps
<=
steps
+
size_in
;
45
ELSE
46
steps
<=
steps
-
size_in
;
47
END
IF
;
48
END
IF
;
49
50
END
PROCESS
pr_count
;
51
52
steps_out
<=
steps
;
53
54
END
ARCHITECTURE
sim
;
sim_step_counter.dir_in
in dir_instd_logic
Direction.
Definition:
sim_step_counter.vhd:20
sim_step_counter.sim.steps
integer steps
Current step count.
Definition:
sim_step_counter.vhd:30
sim_step_counter.size_in
in size_ininteger
Size of steps.
Definition:
sim_step_counter.vhd:21
sim_step_counter.steps_out
out steps_outinteger
Current steps.
Definition:
sim_step_counter.vhd:23
sim_step_counter
Entity to count steps.
Definition:
sim_step_counter.vhd:16
sim_step_counter.rst_in
in rst_instd_logic
Asynchronous reset.
Definition:
sim_step_counter.vhd:18
sim_step_counter.step_in
in step_instd_logic
Step input.
Definition:
sim_step_counter.vhd:19
sim_drv8711_spi.ieee
_library_ ieeeieee
Using IEEE library.
Definition:
sim_drv8711_spi.vhd:7
fpga
common
devices
sim
sim_step_counter.vhd
Generated by
1.8.12