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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [syn/] [components/] [sd_card/] [sim/] [main.cpp] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 alfik
#include <cstdio>
2
#include <cstdlib>
3
 
4
#include <sys/mman.h>
5
#include <sys/types.h>
6
#include <sys/stat.h>
7
#include <fcntl.h>
8
#include <unistd.h>
9
 
10
#include "Vdriver_sd.h"
11
#include "verilated.h"
12
#include "verilated_vcd_c.h"
13
 
14
//------------------------------------------------------------------------------
15
 
16
typedef unsigned long long uint64;
17
 
18
//------------------------------------------------------------------------------
19
 
20
int main(int argc, char **argv) {
21
 
22
    //--------------------------------------------------------------------------
23
 
24
    Verilated::commandArgs(argc, argv);
25
 
26
    Verilated::traceEverOn(true);
27
    VerilatedVcdC* tracer = new VerilatedVcdC;
28
 
29
    Vdriver_sd *top = new Vdriver_sd();
30
    top->trace (tracer, 99);
31
    //tracer->rolloverMB(1000000);
32
    tracer->open("main.vcd");
33
 
34
    //reset
35
    bool dump_enabled = true;
36
    vluint64_t halfcycle = 0;
37
 
38
    top->clk = 0; top->rst_n = 1; top->eval(); if(dump_enabled) { tracer->dump(halfcycle); } halfcycle++;
39
    top->clk = 0; top->rst_n = 0; top->eval(); if(dump_enabled) { tracer->dump(halfcycle); } halfcycle++;
40
    top->rst_n = 1;
41
 
42
    //--------------------------------------------------------------------------
43
 
44
    while(!Verilated::gotFinish()) {
45
 
46
 
47
        //----------------------------------------------------------------------
48
        top->clk = 0;
49
        top->eval();
50
 
51
        if(dump_enabled) tracer->dump(halfcycle); halfcycle++;
52
 
53
        top->clk = 1;
54
        top->eval();
55
 
56
        if(dump_enabled) tracer->dump(halfcycle); halfcycle++;
57
 
58
 
59
        tracer->flush();
60
        //usleep(1);
61
 
62
        if(halfcycle > 1000) break;
63
    }
64
    top->final();
65
    delete top;
66
    return 0;
67
}
68
 
69
/*
70
    input               clk,
71
    input               rst_n,
72
 
73
    //
74
    input       [1:0]   avs_address,
75
    input               avs_read,
76
    output      [31:0]  avs_readdata,
77
    input               avs_write,
78
    input       [31:0]  avs_writedata,
79
 
80
    //
81
    output      [31:0]  avm_address,
82
    input               avm_waitrequest,
83
    output              avm_read,
84
    input       [31:0]  avm_readdata,
85
    input               avm_readdatavalid,
86
    output              avm_write,
87
    output      [31:0]  avm_writedata,
88
 
89
    //
90
    output reg          sd_clk,
91
    inout               sd_cmd,
92
    inout       [3:0]   sd_dat
93
*/

powered by: WebSVN 2.1.0

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