|
| 1 | + |
| 2 | +/////////////////////////////////////////////////////////////////////////////// |
| 3 | +// |
| 4 | +// Copyright (c) 2021 Cadence Design Systems, Inc. All rights reserved worldwide. |
| 5 | +// |
| 6 | +// The code contained herein is the proprietary and confidential information |
| 7 | +// of Cadence or its licensors, and is supplied subject to a previously |
| 8 | +// executed license and maintenance agreement between Cadence and customer. |
| 9 | +// This code is intended for use with Cadence high-level synthesis tools and |
| 10 | +// may not be used with other high-level synthesis tools. Permission is only |
| 11 | +// granted to distribute the code as indicated. Cadence grants permission for |
| 12 | +// customer to distribute a copy of this code to any partner to aid in designing |
| 13 | +// or verifying the customer's intellectual property, as long as such |
| 14 | +// distribution includes a restriction of no additional distributions from the |
| 15 | +// partner, unless the partner receives permission directly from Cadence. |
| 16 | +// |
| 17 | +// ALL CODE FURNISHED BY CADENCE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY |
| 18 | +// KIND, AND CADENCE SPECIFICALLY DISCLAIMS ANY WARRANTY OF NONINFRINGEMENT, |
| 19 | +// FITNESS FOR A PARTICULAR PURPOSE OR MERCHANTABILITY. CADENCE SHALL NOT BE |
| 20 | +// LIABLE FOR ANY COSTS OF PROCUREMENT OF SUBSTITUTES, LOSS OF PROFITS, |
| 21 | +// INTERRUPTION OF BUSINESS, OR FOR ANY OTHER SPECIAL, CONSEQUENTIAL OR |
| 22 | +// INCIDENTAL DAMAGES, HOWEVER CAUSED, WHETHER FOR BREACH OF WARRANTY, |
| 23 | +// CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE. |
| 24 | +// |
| 25 | +//////////////////////////////////////////////////////////////////////////////// |
| 26 | + |
| 27 | + |
| 28 | +// Generated by bdw_memgen 20.23-s100 |
| 29 | +// Thu Jun 24 09:00:48 CST 2021 |
| 30 | + |
| 31 | +#if ! defined dram_CC |
| 32 | +#define dram_CC 1 |
| 33 | +#if defined STRATUS && ! defined CYN_DONT_SUPPRESS_MSGS |
| 34 | +#pragma cyn_suppress_msgs NOTE |
| 35 | +#endif // STRATUS && CYN_DONT_SUPPRESS_MSGS |
| 36 | +#include "dram.h" |
| 37 | + |
| 38 | +#ifdef STRATUS_HLS |
| 39 | + sc_uint<8> dram::read0(sc_uint<28> A0, bool WE0) { |
| 40 | + sc_uint<8> DOUT0; |
| 41 | + CYN_BIND(WE0,this->WE0); |
| 42 | + CYN_BIND(A0,this->A0); |
| 43 | + CYN_BIND(DOUT0,this->DOUT0); |
| 44 | + HLS_CONFIG_INSTRUCTION( "access_port", 1 ); |
| 45 | + DOUT0 = mem[A0]; |
| 46 | + return DOUT0; |
| 47 | + } |
| 48 | + |
| 49 | +#endif // STRATUS_HLS |
| 50 | +#ifdef STRATUS_HLS |
| 51 | + sc_uint<8> dram::write0(sc_uint<28> A0, sc_uint<8> DIN0, bool WE0) { |
| 52 | + |
| 53 | + CYN_BIND(WE0,this->WE0); |
| 54 | + CYN_BIND(A0,this->A0); |
| 55 | + CYN_BIND(DIN0,this->DIN0); |
| 56 | + HLS_CONFIG_INSTRUCTION( "access_port", 1 ); |
| 57 | + mem[A0] = DIN0; |
| 58 | + return DIN0; |
| 59 | + } |
| 60 | + |
| 61 | +#endif // STRATUS_HLS |
| 62 | +#ifdef STRATUS_HLS |
| 63 | + void dram::nop0(bool WE0) { |
| 64 | + CYN_BIND(WE0,this->WE0); |
| 65 | + HLS_CONFIG_INSTRUCTION( "access_port", 1 ); |
| 66 | + } |
| 67 | + |
| 68 | +#endif // STRATUS_HLS |
| 69 | + void dram::thread0() { |
| 70 | +#if defined(__GNUC__) && BDW_USE_SCV |
| 71 | + if ( m_p1_tx_0.is_active() ) { |
| 72 | + m_p1_tx_stream->end_tx( m_p1_tx_0, DOUT0.read() ); |
| 73 | + } |
| 74 | +#endif |
| 75 | +#if defined(__GNUC__) |
| 76 | + // Perform an address range check to prevent crashes on out of bounds |
| 77 | + // accesses in SystemC behavioral simulations. |
| 78 | + if((int)(A0.read()) <= WORDCOUNT) { |
| 79 | +#endif |
| 80 | + if(WE0.read() == 0) { |
| 81 | + |
| 82 | +#if defined(__GNUC__) && BDW_USE_SCV |
| 83 | + m_p1_tx_0 = m_p1_tx_stream->begin_write_tx( A0.read(), DIN0.read() ); |
| 84 | +#endif |
| 85 | + |
| 86 | +#if defined(__GNUC__) && defined(BDW_TRACE_MEMS) |
| 87 | + fprintf(stderr,"TRACE: %s%s: %s: write 0x%s to 0x%x\n", name(), "", sc_time_stamp().to_string().c_str(), DIN0.read().to_string(SC_HEX).c_str(), (int)A0.read().to_uint()); |
| 88 | +#endif |
| 89 | + mem[A0.read().to_uint()] = DIN0.read(); |
| 90 | +#if defined(__GNUC__) |
| 91 | + sync_put(A0.read().to_uint()); |
| 92 | +#endif |
| 93 | + } else { |
| 94 | + |
| 95 | +#if defined(__GNUC__) |
| 96 | +#if BDW_USE_SCV |
| 97 | + m_p1_tx_0 = m_p1_tx_stream->begin_read_tx( A0.read() ); |
| 98 | +#endif |
| 99 | + sync_get(A0.read().to_uint()); |
| 100 | +#endif |
| 101 | + |
| 102 | +#if defined(__GNUC__) && defined(BDW_TRACE_MEMS) |
| 103 | + fprintf(stderr,"TRACE: %s: %s: read 0x%s from 0x%x\n", name(), sc_time_stamp().to_string().c_str(), mem[A0.read().to_uint()].to_string(SC_HEX).c_str(), (int)A0.read().to_uint()); |
| 104 | +#endif |
| 105 | + DOUT0 = mem[A0.read().to_uint()]; |
| 106 | + } |
| 107 | + |
| 108 | +#if defined(__GNUC__) |
| 109 | + } |
| 110 | +#endif |
| 111 | + } |
| 112 | +#if defined(STRATUS_VLG) |
| 113 | + dram::dram(const sc_module_name name) |
| 114 | + : sc_module( name ) ,CLK("CLK"),WE0("WE0"),DIN0("DIN0"),DOUT0("DOUT0"),A0("A0"), mem() |
| 115 | +#else |
| 116 | + dram::dram( sc_module_name name) |
| 117 | + : sc_module( name ) ,CLK("CLK"),WE0("WE0"),DIN0("DIN0"),DOUT0("DOUT0"),A0("A0"), mem() |
| 118 | +#if defined(__GNUC__) |
| 119 | + , m_iface(0) |
| 120 | +#endif |
| 121 | +#endif |
| 122 | + { |
| 123 | +#ifdef STRATUS_HLS |
| 124 | + SC_CTHREAD( thread0, (CLK).pos() ); |
| 125 | +#else |
| 126 | + SC_METHOD( thread0 ); |
| 127 | + sensitive << (CLK).pos(); |
| 128 | + |
| 129 | +#endif |
| 130 | +#ifndef STRATUS_HLS |
| 131 | + dont_initialize(); |
| 132 | +#endif |
| 133 | +#if defined(__GNUC__) && BDW_USE_SCV |
| 134 | + esc_enable_scv_logging(); |
| 135 | + m_p1_tx_stream = new cynw_scv_memory_tx_stream< sc_uint<28>, sc_uint<8> >( (std::string("sc_main.") + std::string(this->name())).c_str(), esc_get_scv_tr_db() ); |
| 136 | +#endif |
| 137 | + |
| 138 | + } |
| 139 | + |
| 140 | +const unsigned long dram::implemented = 1; |
| 141 | +const unsigned long dram::pipelined = 1; |
| 142 | +const float dram::area = 0; |
| 143 | +const float dram::delay = 1; |
| 144 | +const float dram::setup_time = 1; |
| 145 | +const unsigned long dram::latency_WE0 = 1; |
| 146 | +const unsigned long dram::latency_DIN0 = 1; |
| 147 | +const unsigned long dram::latency_A0 = 1; |
| 148 | +const unsigned long dram::bits_per_maskbit_WM0 = 0; |
| 149 | +const unsigned long dram::reg_mem_inputs = 0; |
| 150 | +const unsigned long dram::reg_mem_outputs = 0; |
| 151 | +const unsigned long dram::regs_at_mem_inputs = 0; |
| 152 | +const unsigned long dram::regs_at_mem_outputs = 0; |
| 153 | +const unsigned long dram::no_spec_reads = 1; |
| 154 | +const unsigned long dram::is_mem = 1; |
| 155 | +const unsigned long dram::clock_multiplier = 0; |
| 156 | +const bool dram::has_extra_ports = false; |
| 157 | +const bool dram::is_prototype = false; |
| 158 | +const char* dram::naming_convention = 0; |
| 159 | + |
| 160 | +#endif // dram_CC |
| 161 | + |
0 commit comments