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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [bench/] [sysc/] [src/] [OrpsocMain.cpp] - Blame information for rev 44

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

Line No. Rev Author Line
1 44 julius
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  ORPSoC SystemC Testbench                                    ////
4
////                                                              ////
5
////  Description                                                 ////
6
////  ORPSoC Testbench file                                       ////
7
////                                                              ////
8
////  To Do:                                                      ////
9
////                                                              ////
10
////                                                              ////
11
////  Author(s):                                                  ////
12
////      - Jeremy Bennett jeremy.bennett@embecosm.com            ////
13
////      - Julius Baxter jb@orsoc.se                             ////
14
////                                                              ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2009 Authors and OPENCORES.ORG                 ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
 
43
#include "OrpsocMain.h"
44
 
45
#include "Vorpsoc_top.h"
46
//#include "OrpsocAccess.h"
47
//#include "TraceSC.h"
48
//#include "ResetSC.h"
49
//#include "Or1200MonitorSC.h"
50
 
51
 
52
int sc_main (int   argc,
53
             char *argv[] )
54
{
55
  // CPU clock (also used as JTAG TCK) and reset (both active high and low)
56
  sc_time  clkPeriod (BENCH_CLK_HALFPERIOD * 2.0, TIMESCALE_UNIT);
57
 
58
  sc_clock             clk ("clk", clkPeriod);
59
  sc_signal<bool>      rst;
60
  sc_signal<bool>      rstn;
61
 
62
  sc_signal<bool>      jtag_tdi;                // JTAG interface
63
  sc_signal<bool>      jtag_tdo;
64
  sc_signal<bool>      jtag_tms;
65
  sc_signal<bool>      jtag_trst;
66
 
67
  sc_signal<bool>      eth_sync;                // External Ethernet
68
  sc_signal<bool>      eth_tx;
69
  sc_signal<bool>      eth_rx;
70
  sc_signal<bool>      eth_clk;
71
  sc_signal<bool>      eth_md;
72
  sc_signal<bool>      eth_mdc;
73
 
74
  sc_signal<bool>      uart_rx;         // External UART
75
  sc_signal<bool>      uart_tx;
76
 
77
  // Verilator accessor
78
  //OrpsocAccess    *accessor;
79
 
80
  // Modules
81
  Vorpsoc_top *orpsoc;          // Verilated ORPSoC
82
  //TraceSC          *trace;            // Drive VCD
83
 
84
  //ResetSC          *reset;            // Generate a RESET signal
85
  //Or1200MonitorSC  *monitor;          // Handle l.nop x instructions
86
 
87
  // Instantiate the Verilator model, VCD trace handler and accessor
88
  orpsoc     = new Vorpsoc_top ("orpsoc");
89
  //trace      = new TraceSC ("trace", orpsoc, "v-dump.vcd");
90
  //accessor   = new OrpsocAccess (orpsoc);
91
 
92
  // Instantiate the SystemC modules
93
  //reset         = new ResetSC ("reset", BENCH_RESET_TIME);
94
  //monitor       = new Or1200MonitorSC ("monitor", accessor);
95
 
96
  // Connect up ORPSoC
97
  orpsoc->clk_pad_i (clk);
98
  orpsoc->rst_pad_i (rstn);
99
 
100
  orpsoc->dbg_tck_pad_i  (clk);         // JTAG interface
101
  orpsoc->dbg_tdi_pad_i  (jtag_tdi);
102
  orpsoc->dbg_tdo_pad_i  (jtag_tdo);
103
  orpsoc->dbg_tms_pad_i  (jtag_tms);
104
 
105
  orpsoc->eth_sync_pad_o (eth_sync);      // External Ethernet
106
  orpsoc->eth_tx_pad_o   (eth_tx);
107
  orpsoc->eth_rx_pad_i   (eth_rx);
108
  orpsoc->eth_md_pad_io  (eth_md);
109
  orpsoc->eth_mdc_pad_o  (eth_mdc);
110
 
111
  orpsoc->uart0_srx_pad_i (uart_rx);            // External UART
112
  orpsoc->uart0_stx_pad_o (uart_tx);
113
 
114
  // Connect up the VCD trace handler
115
  //trace->clk (clk);                   // Trace
116
 
117
  // Connect up the SystemC  modules
118
  //reset->clk (clk);                   // Reset
119
  //reset->rst (rst);
120
  //reset->rstn (rstn);
121
 
122
  //monitor->clk (clk);                 // Monitor
123
 
124
  // Tie off signals
125
  jtag_tdi      = 1;                    // Tie off the JTAG inputs
126
  jtag_tms      = 1;
127
 
128
 
129
  uart_rx       = 1;                    // Tie off the UART
130
 
131
  // Execute until we stop
132
  sc_start ();
133
 
134
  // Free memory
135
  //delete monitor;
136
  //delete reset;
137
 
138
  //delete accessor;
139
 
140
  //delete trace;
141
  delete orpsoc;
142
 
143
  return 0;
144
 
145
}       /* sc_main() */

powered by: WebSVN 2.1.0

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