aboutsummaryrefslogtreecommitdiffstats
path: root/dot_product/dot_product/dot_product/dot_product.v9/cycle.v
blob: 6f330943d2e20b6ed11f10fc1f8542fb0ff4da74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// ----------------------------------------------------------------------
//  HLS HDL:        Verilog Netlister
//  HLS Version:    2011a.126 Production Release
//  HLS Date:       Wed Aug  8 00:52:07 PDT 2012
// 
//  Generated by:   mg3115@EEWS104A-015
//  Generated date: Tue Mar 01 14:54:47 2016
// ----------------------------------------------------------------------

// 
// ------------------------------------------------------------------
//  Design Unit:    dot_product_core
// ------------------------------------------------------------------


module dot_product_core (
  clk, en, arst_n, input_a_rsc_mgc_in_wire_d, input_b_rsc_mgc_in_wire_d, output_rsc_mgc_out_stdreg_d
);
  input clk;
  input en;
  input arst_n;
  input [7:0] input_a_rsc_mgc_in_wire_d;
  input [7:0] input_b_rsc_mgc_in_wire_d;
  output [7:0] output_rsc_mgc_out_stdreg_d;
  reg [7:0] output_rsc_mgc_out_stdreg_d;



  // Interconnect Declarations for Component Instantiations 
  always @(*)
  begin : core
    // Interconnect Declarations
    reg [7:0] MAC_4_mul_itm;
    reg [7:0] MAC_acc_6_itm;
    reg [7:0] MAC_acc_itm;
    reg [7:0] MAC_2_mul_itm;

    begin : mainExit
      forever begin : main
        // C-Step 0 of Loop 'main'
        begin : waitLoop0Exit
          forever begin : waitLoop0
            @(posedge clk or negedge ( arst_n ));
            if ( ~ arst_n )
              disable mainExit;
            if ( en )
              disable waitLoop0Exit;
          end
        end
        // C-Step 1 of Loop 'main'
        MAC_4_mul_itm = conv_u2u_16_8(input_a_rsc_mgc_in_wire_d * input_b_rsc_mgc_in_wire_d);
        begin : waitLoop1Exit
          forever begin : waitLoop1
            @(posedge clk or negedge ( arst_n ));
            if ( ~ arst_n )
              disable mainExit;
            if ( en )
              disable waitLoop1Exit;
          end
        end
        // C-Step 2 of Loop 'main'
        MAC_acc_6_itm = MAC_4_mul_itm + conv_u2u_16_8(input_a_rsc_mgc_in_wire_d *
            input_b_rsc_mgc_in_wire_d);
        begin : waitLoop2Exit
          forever begin : waitLoop2
            @(posedge clk or negedge ( arst_n ));
            if ( ~ arst_n )
              disable mainExit;
            if ( en )
              disable waitLoop2Exit;
          end
        end
        // C-Step 3 of Loop 'main'
        MAC_acc_itm = MAC_acc_6_itm + conv_u2u_16_8(input_a_rsc_mgc_in_wire_d * input_b_rsc_mgc_in_wire_d);
        begin : waitLoop3Exit
          forever begin : waitLoop3
            @(posedge clk or negedge ( arst_n ));
            if ( ~ arst_n )
              disable mainExit;
            if ( en )
              disable waitLoop3Exit;
          end
        end
        // C-Step 4 of Loop 'main'
        MAC_2_mul_itm = conv_u2u_16_8(input_a_rsc_mgc_in_wire_d * input_b_rsc_mgc_in_wire_d);
        begin : waitLoop4Exit
          forever begin : waitLoop4
            @(posedge clk or negedge ( arst_n ));
            if ( ~ arst_n )
              disable mainExit;
            if ( en )
              disable waitLoop4Exit;
          end
        end
        // C-Step 5 of Loop 'main'
        output_rsc_mgc_out_stdreg_d <= MAC_acc_itm + (MAC_2_mul_itm + conv_u2u_16_8(input_a_rsc_mgc_in_wire_d
            * input_b_rsc_mgc_in_wire_d));
        begin : waitLoop5Exit
          forever begin : waitLoop5
            @(posedge clk or negedge ( arst_n ));
            if ( ~ arst_n )
              disable mainExit;
            if ( en )
              disable waitLoop5Exit;
          end
        end
        // C-Step 6 of Loop 'main'
      end
    end
    MAC_2_mul_itm = 8'b0;
    MAC_acc_itm = 8'b0;
    MAC_acc_6_itm = 8'b0;
    MAC_4_mul_itm = 8'b0;
    output_rsc_mgc_out_stdreg_d <= 8'b0;
  end


  function  [7:0] conv_u2u_16_8 ;
    input [15:0]  vector ;
  begin
    conv_u2u_16_8 = vector[7:0];
  end
  endfunction

endmodule

// ------------------------------------------------------------------
//  Design Unit:    dot_product
//  Generated from file(s):
//    2) $PROJECT_HOME/../student_files_2015/student_files_2015/prj1/dot_product_source/dot_product.cpp
// ------------------------------------------------------------------


module dot_product (
  input_a_rsc_z, input_b_rsc_z, output_rsc_z, clk, en, arst_n
);
  input [7:0] input_a_rsc_z;
  input [7:0] input_b_rsc_z;
  output [7:0] output_rsc_z;
  input clk;
  input en;
  input arst_n;


  // Interconnect Declarations
  wire [7:0] input_a_rsc_mgc_in_wire_d;
  wire [7:0] input_b_rsc_mgc_in_wire_d;
  wire [7:0] output_rsc_mgc_out_stdreg_d;


  // Interconnect Declarations for Component Instantiations 
  mgc_in_wire #(.rscid(1),
  .width(8)) input_a_rsc_mgc_in_wire (
      .d(input_a_rsc_mgc_in_wire_d),
      .z(input_a_rsc_z)
    );
  mgc_in_wire #(.rscid(2),
  .width(8)) input_b_rsc_mgc_in_wire (
      .d(input_b_rsc_mgc_in_wire_d),
      .z(input_b_rsc_z)
    );
  mgc_out_stdreg #(.rscid(3),
  .width(8)) output_rsc_mgc_out_stdreg (
      .d(output_rsc_mgc_out_stdreg_d),
      .z(output_rsc_z)
    );
  dot_product_core dot_product_core_inst (
      .clk(clk),
      .en(en),
      .arst_n(arst_n),
      .input_a_rsc_mgc_in_wire_d(input_a_rsc_mgc_in_wire_d),
      .input_b_rsc_mgc_in_wire_d(input_b_rsc_mgc_in_wire_d),
      .output_rsc_mgc_out_stdreg_d(output_rsc_mgc_out_stdreg_d)
    );
endmodule