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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [orp/] [orp_soc/] [bench/] [models/] [codec_model.v] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 779 lampret
//////////////////////////////////////////////////////////////////////
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: not supported by cvs2svn $
59
// Revision 1.1.1.1  2002/03/21 16:55:44  lampret
60
// First import of the "new" XESS XSV environment.
61
//
62
 
63
`include "timescale.v"
64
 
65
module codec_model (
66
        mclk, lrclk, sclk, sdin, sdout
67
);
68
 
69
input   mclk;
70
input   lrclk;
71
input   sclk;
72
input   sdin;
73
output  sdout;
74
 
75
reg [19:0]       left_data;
76
reg [19:0]       right_data;
77
integer         left_count, right_count;
78
 
79
// The file descriptors
80
integer         left_file, right_file;
81
 
82
        assign sdout = 1'b0;
83
 
84
// Opening the files for output data
85
initial
86
   begin
87
        left_file = $fopen("../out/left.dat");
88
        right_file = $fopen("../out/right.dat");
89
   end // of opening files
90
 
91
always @(negedge lrclk)
92
   begin
93
        left_count = 19;
94
        right_count = 19;
95
        $fdisplay(left_file, left_data);
96
        $fdisplay(right_file, right_data);
97
   end
98
 
99
always @(negedge sclk)
100
   begin
101
      if ((left_count > 0) &  (lrclk == 1'b0)) begin
102
        left_data[left_count] <= sdin;
103
        left_count <= left_count - 1;
104
      end
105
      if ((right_count > 0) & (lrclk == 1'b1)) begin
106
        right_data[right_count] <= sdin;
107
        right_count <= right_count - 1;
108
      end
109
   end
110
 
111
endmodule

powered by: WebSVN 2.1.0

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