OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [o8_vdsm8.vhd] - Blame information for rev 219

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 213 jshamlet
-- Copyright (c)2016, 2020 Jeremy Seth Henry
2 167 jshamlet
-- All rights reserved.
3
--
4
-- Redistribution and use in source and binary forms, with or without
5
-- modification, are permitted provided that the following conditions are met:
6
--     * Redistributions of source code must retain the above copyright
7
--       notice, this list of conditions and the following disclaimer.
8
--     * Redistributions in binary form must reproduce the above copyright
9
--       notice, this list of conditions and the following disclaimer in the
10
--       documentation and/or other materials provided with the distribution,
11
--       where applicable (as part of a user interface, debugging port, etc.)
12
--
13
-- THIS SOFTWARE IS PROVIDED BY JEREMY SETH HENRY ``AS IS'' AND ANY
14
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
17
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 194 jshamlet
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 167 jshamlet
--
24
-- VHDL Units :  o8_vdsm8
25 217 jshamlet
-- Description:  8-bit variable delta-sigma modulator.
26 213 jshamlet
--
27
-- Revision History
28
-- Author          Date     Change
29
------------------ -------- ---------------------------------------------------
30
-- Seth Henry      06/23/16 Design start
31
-- Seth Henry      04/10/20 Code Cleanup
32 167 jshamlet
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35
use ieee.std_logic_unsigned.all;
36
use ieee.std_logic_arith.all;
37
 
38
library work;
39
  use work.open8_pkg.all;
40
 
41
entity o8_vdsm8 is
42
generic(
43 217 jshamlet
  Reset_Level                : std_logic;
44
  Address                    : ADDRESS_TYPE
45 167 jshamlet
);
46
port(
47 217 jshamlet
  Clock                      : in  std_logic;
48
  Reset                      : in  std_logic;
49 167 jshamlet
  --
50 217 jshamlet
  Bus_Address                : in  ADDRESS_TYPE;
51
  Wr_Enable                  : in  std_logic;
52
  Wr_Data                    : in  DATA_TYPE;
53
  Rd_Enable                  : in  std_logic;
54
  Rd_Data                    : out DATA_TYPE;
55 167 jshamlet
  --
56 217 jshamlet
  DACout                     : out std_logic
57 167 jshamlet
);
58
end entity;
59
 
60
architecture behave of o8_vdsm8 is
61
 
62 217 jshamlet
  constant User_Addr         : std_logic_vector(15 downto 0) := Address;
63
  alias  Comp_Addr           is Bus_Address(15 downto 0);
64
  signal Addr_Match          : std_logic := '0';
65
  signal Wr_En               : std_logic := '0';
66
  signal Wr_Data_q           : DATA_TYPE := x"00";
67
  signal Rd_En               : std_logic := '0';
68
  signal DACin               : DATA_TYPE := x"00";
69 172 jshamlet
 
70
 
71 167 jshamlet
begin
72
 
73 217 jshamlet
  Addr_Match                 <= '1' when Comp_Addr = User_Addr else '0';
74 167 jshamlet
 
75
  io_reg: process( Clock, Reset )
76
  begin
77
    if( Reset = Reset_Level )then
78 217 jshamlet
      Wr_En                  <= '0';
79
      Wr_Data_q              <= x"00";
80
      Rd_En                  <= '0';
81
      Rd_Data                <= OPEN8_NULLBUS;
82
      DACin                  <= x"00";
83 167 jshamlet
    elsif( rising_edge( Clock ) )then
84 217 jshamlet
      Wr_En                  <= Addr_Match and Wr_Enable;
85
      Wr_Data_q              <= Wr_Data;
86 167 jshamlet
      if( Wr_En = '1' )then
87 217 jshamlet
        DACin                <= Wr_Data_q;
88 172 jshamlet
      end if;
89 167 jshamlet
 
90 217 jshamlet
      Rd_Data                <= OPEN8_NULLBUS;
91
      Rd_En                  <= Addr_Match and Rd_Enable;
92 167 jshamlet
      if( Rd_En = '1' )then
93 217 jshamlet
        Rd_Data              <= DACin;
94 167 jshamlet
      end if;
95
    end if;
96
  end process;
97
 
98 217 jshamlet
  U_DAC : entity work.vdsm8
99
  generic map(
100
    Reset_Level              => Reset_Level
101
  )
102
  port map(
103
    Clock                    => Clock,
104
    Reset                    => Reset,
105
    DACin                    => DACin,
106
    DACout                   => DACout
107
  );
108 167 jshamlet
 
109
end architecture;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.