Motion FPGA
Motion FPGA for the MachX02-7000HE Breakout Board
sdm_device.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 --! @file
3 --! @brief Sigma-Delta modulator device
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 device entity
16 --!
17 --! This entity manages four sigma-delta modulators. The write register
18 --! contains the new four 8-bit levels. The read register contains the current
19 --! four 8-bit levels.
20 ENTITY sdm_device IS
21  PORT (
22  clk_in : IN std_logic; --! Clock
23  rst_in : IN std_logic; --! Asynchronous reset
24  dat_wr_done_in : IN std_logic; --! Device Write Done flag
25  dat_wr_reg_in : IN std_logic_vector(31 DOWNTO 0); --! Device Write Register value
26  dat_rd_reg_out : OUT std_logic_vector(31 DOWNTO 0); --! Device Read Register value
27  sdm_out : OUT std_logic_vector(3 DOWNTO 0) --! Modulator outputs
28  );
29 END ENTITY sdm_device;
30 
31 --! Architecture rtl of sdm_device entity
32 ARCHITECTURE rtl OF sdm_device IS
33 
34  --! Array type of four levels
35  TYPE sdm_level_set IS ARRAY (3 DOWNTO 0) OF std_logic_vector(7 DOWNTO 0);
36 
37  --! Levels array
39 
40 BEGIN
41 
42  --! Generate four Sigma-Delta modulators
43  g_sdm : FOR i IN 0 TO 3 GENERATE
44 
45  --! Generate Sigma-Delta modulator instance
46  i_sdm : ENTITY work.sdm(rtl)
47  GENERIC MAP (
48  bit_width => 8
49  )
50  PORT MAP (
51  clk_in => clk_in,
52  rst_in => rst_in,
53  sdm_level_in => sdm_level(i),
54  sdm_out => sdm_out(i)
55  );
56 
57  END GENERATE g_sdm;
58 
59  --! @brief Process to handle writes and resets
60  pr_write : PROCESS (clk_in, rst_in) IS
61  BEGIN
62 
63  IF (rst_in = '1') THEN
64  -- Reset levels
65  sdm_level(3) <= (OTHERS => '0');
66  sdm_level(2) <= (OTHERS => '0');
67  sdm_level(1) <= (OTHERS => '0');
68  sdm_level(0) <= (OTHERS => '0');
69  ELSIF (rising_edge(clk_in)) THEN
70  IF (dat_wr_done_in = '1') THEN
71  -- Set levels from write register
72  sdm_level(3) <= dat_wr_reg_in(31 DOWNTO 24);
73  sdm_level(2) <= dat_wr_reg_in(23 DOWNTO 16);
74  sdm_level(1) <= dat_wr_reg_in(15 DOWNTO 8);
75  sdm_level(0) <= dat_wr_reg_in(7 DOWNTO 0);
76  END IF;
77  END IF;
78 
79  END PROCESS pr_write;
80 
81  --! @brief Process to handle reads
82  pr_read : PROCESS (clk_in) IS
83  BEGIN
84 
85  IF (rising_edge(clk_in)) THEN
86  -- Populate read register with levels
87  dat_rd_reg_out <= std_logic_vector(sdm_level(3)) &
88  std_logic_vector(sdm_level(2)) &
89  std_logic_vector(sdm_level(1)) &
90  std_logic_vector(sdm_level(0));
91  END IF;
92 
93  END PROCESS pr_read;
94 
95 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
( 3 DOWNTO 0) std_logic_vector( 7 DOWNTO 0) sdm_level_set
Array type of four levels.
Definition: sdm_device.vhd:35
in clk_instd_logic
Clock.
Definition: sdm_device.vhd:22
in dat_wr_done_instd_logic
Device Write Done flag.
Definition: sdm_device.vhd:24
in clk_instd_logic
Clock.
Definition: sdm.vhd:24
out sdm_outstd_logic
Modulator output.
Definition: sdm.vhd:28
out sdm_outstd_logic_vector( 3 DOWNTO 0)
Modulator outputs.
Definition: sdm_device.vhd:28
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
in rst_instd_logic
Asynchronous reset.
Definition: sdm_device.vhd:23
_library_ ieeeieee
Using IEEE library.
Definition: pwm_device.vhd:7
sdm_level_set sdm_level
Levels array.
Definition: sdm_device.vhd:38
Sigma-Delta modulator device entity.
Definition: sdm_device.vhd:20
in dat_wr_reg_instd_logic_vector( 31 DOWNTO 0)
Device Write Register value.
Definition: sdm_device.vhd:25
out dat_rd_reg_outstd_logic_vector( 31 DOWNTO 0)
Device Read Register value.
Definition: sdm_device.vhd:26