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 47

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 47 julius
  sc_signal<bool>      rst_o;
62 44 julius
 
63
  sc_signal<bool>      jtag_tdi;                // JTAG interface
64
  sc_signal<bool>      jtag_tdo;
65
  sc_signal<bool>      jtag_tms;
66
  sc_signal<bool>      jtag_trst;
67
 
68
  sc_signal<bool>      uart_rx;         // External UART
69
  sc_signal<bool>      uart_tx;
70
 
71 47 julius
  sc_signal<bool> spi_sd_sclk; // SD Card Memory SPI
72
  sc_signal<bool> spi_sd_ss;
73
  sc_signal<bool> spi_sd_miso;
74
  sc_signal<bool> spi_sd_mosi;
75
 
76
  sc_signal<uint32_t> gpio_a; // GPIO bus - output only in verilator sims
77
 
78
  sc_signal<bool> spi1_mosi;
79
  sc_signal<bool> spi1_miso;
80
  sc_signal<bool> spi1_ss;
81
  sc_signal<bool> spi1_sclk;
82
 
83
 
84 44 julius
  // Verilator accessor
85
  //OrpsocAccess    *accessor;
86
 
87
  // Modules
88
  Vorpsoc_top *orpsoc;          // Verilated ORPSoC
89
  //TraceSC          *trace;            // Drive VCD
90
 
91
  //ResetSC          *reset;            // Generate a RESET signal
92
  //Or1200MonitorSC  *monitor;          // Handle l.nop x instructions
93
 
94
  // Instantiate the Verilator model, VCD trace handler and accessor
95
  orpsoc     = new Vorpsoc_top ("orpsoc");
96
  //trace      = new TraceSC ("trace", orpsoc, "v-dump.vcd");
97
  //accessor   = new OrpsocAccess (orpsoc);
98
 
99
  // Instantiate the SystemC modules
100
  //reset         = new ResetSC ("reset", BENCH_RESET_TIME);
101
  //monitor       = new Or1200MonitorSC ("monitor", accessor);
102
 
103
  // Connect up ORPSoC
104
  orpsoc->clk_pad_i (clk);
105
  orpsoc->rst_pad_i (rstn);
106 47 julius
  orpsoc->rst_pad_o (rst_o);
107 44 julius
 
108
  orpsoc->dbg_tck_pad_i  (clk);         // JTAG interface
109
  orpsoc->dbg_tdi_pad_i  (jtag_tdi);
110
  orpsoc->dbg_tms_pad_i  (jtag_tms);
111 47 julius
  orpsoc->dbg_tdo_pad_o  (jtag_tdo);
112 44 julius
 
113
  orpsoc->uart0_srx_pad_i (uart_rx);            // External UART
114
  orpsoc->uart0_stx_pad_o (uart_tx);
115
 
116 47 julius
  orpsoc->spi_sd_sclk_pad_o (spi_sd_sclk); // SD Card Memory SPI
117
  orpsoc->spi_sd_ss_pad_o (spi_sd_ss);
118
  orpsoc->spi_sd_miso_pad_i (spi_sd_miso);
119
  orpsoc->spi_sd_mosi_pad_o (spi_sd_mosi);
120
 
121
  orpsoc->spi1_mosi_pad_o (spi1_mosi);
122
  orpsoc->spi1_miso_pad_i (spi1_miso);
123
  orpsoc->spi1_ss_pad_o  (spi1_ss);
124
  orpsoc->spi1_sclk_pad_o (spi1_sclk);
125
 
126
 
127
  orpsoc->gpio_a_pad_io (gpio_a); // GPIO bus - output only in 
128
                                  // verilator sims
129
 
130
 
131 44 julius
  // Connect up the VCD trace handler
132
  //trace->clk (clk);                   // Trace
133
 
134
  // Connect up the SystemC  modules
135
  //reset->clk (clk);                   // Reset
136
  //reset->rst (rst);
137
  //reset->rstn (rstn);
138
 
139
  //monitor->clk (clk);                 // Monitor
140
 
141
  // Tie off signals
142
  jtag_tdi      = 1;                    // Tie off the JTAG inputs
143
  jtag_tms      = 1;
144
 
145
  uart_rx       = 1;                    // Tie off the UART
146
 
147 47 julius
  spi_sd_miso = 0; // Tie off master-in/slave-out of SD SPI bus
148
 
149
  spi1_miso = 0;
150
 
151
  printf("Beginning test\n");
152
 
153 44 julius
  // Execute until we stop
154
  sc_start ();
155
 
156
  // Free memory
157
  //delete monitor;
158
  //delete reset;
159
 
160
  //delete accessor;
161
 
162
  //delete trace;
163
  delete orpsoc;
164
 
165
  return 0;
166
 
167
}       /* sc_main() */

powered by: WebSVN 2.1.0

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