1 |
2 |
alfoltran |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// USB RAM ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// SystemC Version: usb_ram64x8.cpp ////
|
6 |
|
|
//// Author: Alfredo Luiz Foltran Fialho ////
|
7 |
|
|
//// alfoltran@ig.com.br ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// ////
|
10 |
|
|
/////////////////////////////////////////////////////////////////////
|
11 |
|
|
//// ////
|
12 |
|
|
//// Verilog Version: generic_dpram.v ////
|
13 |
|
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
14 |
|
|
//// www.opencores.org ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source file may be used and distributed without ////
|
17 |
|
|
//// restriction provided that this copyright statement is not ////
|
18 |
|
|
//// removed from the file and that any derivative work contains ////
|
19 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
20 |
|
|
//// ////
|
21 |
|
|
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
|
22 |
|
|
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
|
23 |
|
|
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
|
24 |
|
|
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
|
25 |
|
|
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
|
26 |
|
|
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
|
27 |
|
|
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
|
28 |
|
|
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
|
29 |
|
|
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
|
30 |
|
|
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
|
31 |
|
|
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
|
32 |
|
|
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
|
33 |
|
|
//// POSSIBILITY OF SUCH DAMAGE. ////
|
34 |
|
|
//// ////
|
35 |
|
|
/////////////////////////////////////////////////////////////////////
|
36 |
|
|
|
37 |
|
|
#include "systemc.h"
|
38 |
|
|
#include "usb_ram64x8.h"
|
39 |
|
|
|
40 |
|
|
void usb_ram64x8::dout_update(void) {
|
41 |
|
|
dout.write((oe.read() && rce.read()) ? dout_reg.read() : (sc_uint<8>)0);
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
void usb_ram64x8::read(void) {
|
45 |
|
|
if (rce.read())
|
46 |
|
|
dout_reg.write(mem[raddr.read()]);
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
void usb_ram64x8::write(void) {
|
50 |
|
|
if (wce.read() && we.read())
|
51 |
|
|
mem[waddr.read()] = din.read();
|
52 |
|
|
}
|
53 |
|
|
|