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

Subversion Repositories alu_with_selectable_inputs_and_outputs

[/] [alu_with_selectable_inputs_and_outputs/] [trunk/] [verif_env/] [collectors/] [input_collector.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dragos_don
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////      This project has been provided to you on behalf of:    ////
4
////                                                             ////
5
////            S.C. ASICArt S.R.L.                              ////
6
////                            www.asicart.com                  ////
7
////                            eli_f@asicart.com                ////
8
////                                                             ////
9
////        Author: Dragos Constantin Doncean                    ////
10
////        Email: doncean@asicart.com                           ////
11
////        Mobile: +40-740-936997                               ////
12
////                                                             ////
13
////      Downloaded from: http://www.opencores.org/             ////
14
////                                                             ////
15
/////////////////////////////////////////////////////////////////////
16
////                                                             ////
17
//// Copyright (C) 2007 Dragos Constantin Doncean                ////
18
////                         www.asicart.com                     ////
19
////                         doncean@asicart.com                 ////
20
////                                                             ////
21
//// This source file may be used and distributed without        ////
22
//// restriction provided that this copyright statement is not   ////
23
//// removed from the file and that any derivative work contains ////
24
//// the original copyright notice and the associated disclaimer.////
25
////                                                             ////
26
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
27
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
28
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
29
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
30
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
31
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
32
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
33
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
34
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
35
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
36
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
37
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
38
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
39
////                                                             ////
40
/////////////////////////////////////////////////////////////////////
41
 
42
 
43
//----------------Collectors----------------
44
 
45
//INPUT COLLECTOR
46
 
47
module INPUT_COLLECTOR(ic_clk, ic_res, ic_stb,
48
        ic_sel,
49
        ic_data_in_0, ic_data_in_1, ic_data_in_2,
50
        ic_data_valid_in,
51
        ic_data_out_0, ic_data_out_1, ic_data_out_2, ic_data_out_3,
52
        ic_data_collected);
53
 
54
input ic_clk, ic_res, ic_stb;
55
input [1:0] ic_sel;
56
input [7:0] ic_data_in_0, ic_data_in_1, ic_data_in_2;
57
input ic_data_valid_in;
58
output [7:0] ic_data_out_0, ic_data_out_1, ic_data_out_2, ic_data_out_3;
59
output [0:127] ic_data_collected;
60
 
61
reg ic_stb_was_1;
62
 
63
reg [7:0] ic_data_out_0, ic_data_out_1, ic_data_out_2, ic_data_out_3;
64
reg [0:127] ic_data_collected;
65
 
66
reg [7:0] ic_data[0:3];
67
integer i, j, k;
68
 
69
integer fh;
70
 
71
always @ (posedge ic_clk or posedge ic_res)
72
if(ic_res)
73
begin
74
        ic_stb_was_1 = 0;
75
        ic_data_out_0 = 0;
76
        ic_data_out_1 = 0;
77
        ic_data_out_2 = 0;
78
        ic_data_out_3 = 0;
79
        ic_data_collected = 0;
80
        for(j = 0; j < 4; j = j + 1)
81
                ic_data[j] = 0;
82
        i = 0;
83
        j = 0;
84
        k = 0;
85
end
86
else
87
begin
88
        if(ic_stb)
89
                ic_stb_was_1 = 1;
90
        if(ic_data_valid_in)
91
        begin
92
                case(ic_sel)
93
                        'd0: ic_data[k] = ic_data_in_0;
94
                        'd1: ic_data[k] = ic_data_in_1;
95
                        'd2: ic_data[k] = ic_data_in_2;
96
                endcase
97
                k = k + 1;
98
        end
99
        else
100
        begin
101
                if(ic_stb_was_1)
102
                begin
103
                        k = 0;
104
                        for(j = 0; j < 4; j = j + 1)
105
                                case(j)
106
                                        'd0: ic_data_out_0 = ic_data[j];
107
                                        'd1: ic_data_out_1 = ic_data[j];
108
                                        'd2: ic_data_out_2 = ic_data[j];
109
                                        'd3: ic_data_out_3 = ic_data[j];
110
                                endcase
111
                end
112
                if(ic_stb_was_1)
113
                begin
114
                        ic_data_collected[i] = 1;
115
                        i = i + 1;
116
                        ic_stb_was_1 = 0;
117
                end
118
        end
119
end
120
 
121
//Print INPUT COLLECTOR buffer contents
122
always @ (i)
123
begin
124
        if(fh === 32'bx)
125
                fh = $fopen("input_collector.out");
126
 
127
        $fdisplay(fh, "%0d INFO: Input Transaction no: %0d", $time, i);
128
        $fdisplay(fh, "%0d INFO: ic_data_out_0 = %b", $time, ic_data_out_0);
129
        // split ic_data_out_0
130
        $fdisplay(fh, "\tINFO: operator type = %0d", ic_data_out_0[7:4]);
131
        $fdisplay(fh, "\tINFO: operator symbol = %0d", ic_data_out_0[3:1]);
132
        $fdisplay(fh, "\tINFO: output channel = %0d", ic_data_out_0[0]);
133
        //
134
        $fdisplay(fh, "%0d INFO: ic_data_out_1 = %b", $time, ic_data_out_1);
135
        $fdisplay(fh, "%0d INFO: ic_data_out_2 = %b", $time, ic_data_out_2);
136
        $fdisplay(fh, "%0d INFO: ic_data_out_3 = %b\n", $time, ic_data_out_3);
137
 
138
        //$fclose(fh);
139
end
140
 
141
endmodule

powered by: WebSVN 2.1.0

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