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

Subversion Repositories mips32r1

[/] [mips32r1/] [trunk/] [Hardware/] [XUPV5-LX110T_SoC/] [MIPS32-Pipelined-Hw/] [src/] [Piezo/] [Piezo.v] - Blame information for rev 12

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

Line No. Rev Author Line
1 2 ayersg
`timescale 1ns / 1ps
2
/*
3
 * File         : Piezo.v
4
 * Project      : University of Utah, XUM Project MIPS32 core
5
 * Creator(s)   : Grant Ayers (ayers@cs.utah.edu)
6
 *
7
 * Modification History:
8
 *   Rev   Date         Initials  Description of Change
9
 *   1.0   11-Jun-2012  GEA       Initial design.
10
 *
11
 * Standards/Formatting:
12
 *   Verilog 2001, 4 soft tab, wide column.
13
 *
14
 * Description:
15
 *   A sound driver for a piezo-electric transducer (or other
16
 *   oscillating device). When enabled, the output oscillates
17
 *   between high and low, switching at a rate determined by the
18
 *   'count' register and clock frequency. The output is enabled
19
 *   when the highest bit is set on a Write.
20
 */
21
module Piezo_Driver(
22
    input  clock,
23
    input  reset,
24
    input  [24:0] data,
25
    input  Write,
26
    output reg Ack,
27
    output reg Piezo
28
    );
29
 
30
    reg [23:0] count;
31
    reg [23:0] compare;
32
    reg enabled;
33
 
34
    always @(posedge clock) begin
35
        count   <= (reset | (count == compare)) ? 24'h000000 : count + 1;
36
        compare <= (reset) ? 24'h000000 : ((Write) ? data[23:0] : compare);
37
        enabled <= (reset) ? 0 : ((Write) ? data[24] : enabled);
38
        Piezo   <= (reset | ~enabled) ? 0 : ((count == compare) ? ~Piezo : Piezo);
39
        Ack     <= (reset) ? 0 : Write;
40
    end
41
 
42
endmodule
43 3 ayersg
 

powered by: WebSVN 2.1.0

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