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

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [soc/] [bench/] [models/] [codec_model.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 xianfeng
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Model of AK4520A Codec chip                                 ////
4
////                                                              ////
5
////  This file is part of the OR1K test application              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  The model simulated only mode that is found on Xess XSV     ////
10
////  boards which is defined by:                                 ////
11
////  CMODE = 0                                                   ////
12
////  DIF0  = 0                                                   ////
13
////  DIF1  = 1                                                   ////
14
////  This mode represent MCLK = 256fs                            ////
15
////       20 bit in/out MSB justified, SCLK = 64fs               ////
16
////                                                              ////
17
////  Functionality:                                              ////
18
////  -    The model takes the input channel and dumps the        ////
19
////       samples to an output file.                             ////
20
////  -    The model creates activity on the input channel        ////
21
////       according to an input file. (not yet implemented)      ////
22
////                                                              ////
23
////  To Do:                                                      ////
24
////   - input activity                                           ////
25
////                                                              ////
26
////  Author(s):                                                  ////
27
////      - Lior Shtram, lior.shtram@flextronicssemi.com          ////
28
////                                                              ////
29
//////////////////////////////////////////////////////////////////////
30
////                                                              ////
31
//// Copyright (C) 2002 Author                                    ////
32
////                                                              ////
33
//// This source file may be used and distributed without         ////
34
//// restriction provided that this copyright statement is not    ////
35
//// removed from the file and that any derivative work contains  ////
36
//// the original copyright notice and the associated disclaimer. ////
37
////                                                              ////
38
//// This source file is free software; you can redistribute it   ////
39
//// and/or modify it under the terms of the GNU Lesser General   ////
40
//// Public License as published by the Free Software Foundation; ////
41
//// either version 2.1 of the License, or (at your option) any   ////
42
//// later version.                                               ////
43
////                                                              ////
44
//// This source is distributed in the hope that it will be       ////
45
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
46
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
47
//// PURPOSE.  See the GNU Lesser General Public License for more ////
48
//// details.                                                     ////
49
////                                                              ////
50
//// You should have received a copy of the GNU Lesser General    ////
51
//// Public License along with this source; if not, download it   ////
52
//// from http://www.opencores.org/lgpl.shtml                     ////
53
////                                                              ////
54
//////////////////////////////////////////////////////////////////////
55
//
56
// CVS Revision History
57
//
58
// $Log: codec_model.v,v $
59
// Revision 1.1  2002/03/28 19:59:53  lampret
60
// Added bench directory
61
//
62
// Revision 1.1.1.1  2002/03/21 16:55:44  lampret
63
// First import of the "new" XESS XSV environment.
64
//
65
 
66
`include "timescale.v"
67
 
68
module codec_model (
69
        mclk, lrclk, sclk, sdin, sdout
70
);
71
 
72
input   mclk;
73
input   lrclk;
74
input   sclk;
75
input   sdin;
76
output  sdout;
77
 
78
reg [19:0]       left_data;
79
reg [19:0]       right_data;
80
integer         left_count, right_count;
81
 
82
// The file descriptors
83
integer         left_file, right_file;
84
 
85
        assign sdout = 1'b0;
86
 
87
// Opening the files for output data
88
initial
89
   begin
90
        left_file = $fopen("../out/left.dat");
91
        right_file = $fopen("../out/right.dat");
92
   end // of opening files
93
 
94
always @(negedge lrclk)
95
   begin
96
        left_count = 19;
97
        right_count = 19;
98
        $fdisplay(left_file, left_data);
99
        $fdisplay(right_file, right_data);
100
   end
101
 
102
always @(negedge sclk)
103
   begin
104
      if ((left_count > 0) &  (lrclk == 1'b0)) begin
105
        left_data[left_count] <= sdin;
106
        left_count <= left_count - 1;
107
      end
108
      if ((right_count > 0) & (lrclk == 1'b1)) begin
109
        right_data[right_count] <= sdin;
110
        right_count <= right_count - 1;
111
      end
112
   end
113
 
114
endmodule

powered by: WebSVN 2.1.0

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