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

Subversion Repositories systemc_cordic

[/] [systemc_cordic/] [trunk/] [cordic_ip/] [testbench.h] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 wwcheng
// testbench.h: header file
2
/********************************************************************
3
//
4
// Module:
5
//   Testbench
6
//
7
// Interface:
8
//   This module generates random input vectors to test the CORDIC
9
//   core and checks the result with C math library functions.
10
//
11
//
12
// Authors:     Winnie Cheng <wwcheng@stanford.edu>,
13
//              Peter Wu <peter5@stanford.edu>
14
//
15
 *********************************************************************/
16
#include "systemc.h"
17
#include "opcode.h"
18
 
19
SC_MODULE(testbench) {
20
 
21
    // Clock Declaration
22
    sc_in_clk clk;
23
 
24
    // Input ports Declaration
25
    sc_in<bool> start;
26
    sc_in<bool> reset;
27
    sc_in<bool> compute_done;
28
    sc_in<short> result1;
29
    sc_in<short> result2;
30
    sc_in<bool> monitor_idle;
31
 
32
    // Input ports from result fifo
33
    sc_in<bool> fifo_valid;
34
    sc_in<sc_uint<UNIT_SEL_WIDTH> > fifo_opcode;
35
    sc_in<short> fifo_result1;
36
    sc_in<short> fifo_result2;
37
 
38
    // Output ports Declaration
39
    sc_out<bool> instructions_valid;
40
    sc_out<bool> done;
41
    sc_out<bool> start_monitor;
42
 
43
    // Output data
44
    sc_out<sc_uint<UNIT_SEL_WIDTH> > engine_select;
45
    sc_out<short> operand1;
46
    sc_out<short> operand2;
47
    sc_out<short> operand3;
48
 
49
    // Output to result fifo
50
    sc_out<bool> fifo_read_request;
51
 
52
    // Declare implementation functions
53
    void testbench_process();
54
    void readfifo_process();
55
 
56
    // Constructor
57
    SC_CTOR(testbench)
58
    {
59
        // Register processes and define active clock edge
60
        SC_CTHREAD(testbench_process, clk.pos());
61
        SC_CTHREAD(readfifo_process, clk.pos());
62
 
63
        // Watching for global reset
64
        watching(reset.delayed()==true);
65
    }
66
 
67
}; // end module testbench 

powered by: WebSVN 2.1.0

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