Motion FPGA
Motion FPGA for the MachX02-7000HE Breakout Board
sdm.vhd
1 -------------------------------------------------------------------------------
2 --! @file
3 --! @brief Sigma-Delta Modulator 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 Sigma-Delta modulator entity
16 --!
17 --! This entity is a configurable first-order sigma-delta modulator with
18 --! a configurable bit-width.
19 ENTITY sdm IS
20  GENERIC (
21  bit_width : integer RANGE 1 TO 32 := 8 --! Bit width
22  );
23  PORT (
24  clk_in : IN std_logic; --! Clock
25  rst_in : IN std_logic; --! Asynchronous reset
26  sdm_level_in : IN std_logic_vector(bit_width - 1 DOWNTO 0); --! Modulator level
27  sdm_out : OUT std_logic --! Modulator output
28  );
29 END ENTITY sdm;
30 
31 --! Architecture rtl of sdm entity
32 ARCHITECTURE rtl OF sdm IS
33 
34  --! Modulator accumulator
35  SIGNAL accumulator : unsigned(sdm_level_in'HIGH + 1 DOWNTO 0);
36 
37 BEGIN
38 
39  --! @brief Process for sigma-delta generation
40  pr_sdm : PROCESS (clk_in, rst_in) IS
41  BEGIN
42 
43  IF (rst_in = '1') THEN
44  -- Reset state
45  accumulator <= (OTHERS => '0');
46  ELSIF (rising_edge(clk_in)) THEN
47  -- Accumulate
48  accumulator <= unsigned('0' & accumulator(accumulator'HIGH - 1 DOWNTO 0)) + unsigned('0' & sdm_level_in);
49  END IF;
50 
51  END PROCESS pr_sdm;
52 
53  -- Drive output with MSB of accumulator
55 
56 END ARCHITECTURE rtl;
in rst_instd_logic
Asynchronous reset.
Definition: sdm.vhd:25
in sdm_level_instd_logic_vector( bit_width- 1 DOWNTO 0)
Modulator level.
Definition: sdm.vhd:26
in clk_instd_logic
Clock.
Definition: sdm.vhd:24
out sdm_outstd_logic
Modulator output.
Definition: sdm.vhd:28
_library_ ieeeieee
Using IEEE library.
Definition: quad_decoder.vhd:7
bit_widthinteger range 1 TO 32:= 8
Bit width.
Definition: sdm.vhd:22
Using IEE standard numeric components Sigma-Delta modulator entityThis entity is a configurable firs...
Definition: sdm.vhd:19
unsigned( sdm_level_in'HIGH+ 1 DOWNTO 0) accumulator
Modulator accumulator.
Definition: sdm.vhd:35