Subversion Repositories programming

Rev

Rev 205 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 205 Rev 206
Line 106... Line 106...
106
    end
106
    end
107
 
107
 
108
    always @(negedge clk) begin
108
    always @(negedge clk) begin
109
        counter = counter + 'b1;
109
        counter = counter + 'b1;
110
    end
110
    end
111
/*
111
    
-
 
112
    /* //DEBUGGING INFORMATION
112
    initial begin
113
    initial begin
113
        $monitor ("time=%0d counter=%b clk=%b w_mout=%b w_prod=%b w_aop=%b w_sop=%b w_wop=%b out=%b",
114
        $monitor ("time=%0d counter=%b clk=%b w_mout=%b w_prod=%b w_aop=%b w_sop=%b w_wop=%b out=%b",
114
               $time, counter, clk, w_mout, w_prod, w_aop, w_sop, w_wop, out);
115
               $time, counter, clk, w_mout, w_prod, w_aop, w_sop, w_wop, out);
115
    end
116
    end
116
*/
117
    */
-
 
118
    
117
    wire[0:7] w_prod;
119
    wire[0:7] w_prod;
118
    wire[0:3] w_mout, w_alu_out;
120
    wire[0:3] w_mout, w_alu_out;
119
    wire[0:1] w_aop;
121
    wire[0:1] w_aop;
120
    wire w_sop, w_wop, w_cout;
122
    wire w_sop, w_wop, w_cout;
121
    reg cin;
123
    reg cin;
Line 123... Line 125...
123
    MUL4_PRODUCT mp (w_alu_out, a, w_sop, w_wop, w_prod, clk);
125
    MUL4_PRODUCT mp (w_alu_out, a, w_sop, w_wop, w_prod, clk);
124
    MUL4_MULTIPLICAND mm (b, w_mout, clk);
126
    MUL4_MULTIPLICAND mm (b, w_mout, clk);
125
    MUL4_CONTROL mc (w_prod[7], w_aop, w_wop, w_sop, clk, counter);
127
    MUL4_CONTROL mc (w_prod[7], w_aop, w_wop, w_sop, clk, counter);
126
    ALU4 ma (w_prod[0:3], w_mout, cin, w_aop, w_cout, w_alu_out);
128
    ALU4 ma (w_prod[0:3], w_mout, cin, w_aop, w_cout, w_alu_out);
127
 
129
 
-
 
130
    // Set the output, since we have a valid result right now.
-
 
131
    // Also reset the counter every time it reaches 4, it is used
-
 
132
    // to keep the MUL4_CONTROL in sync.
128
    always @(counter) begin
133
    always @(counter) begin
129
        if (counter == 4) begin
134
        if (counter == 4) begin
130
            force out = w_prod;
135
            force out = w_prod; // set the output
131
            counter = 'b1111; //reset counter
136
            counter = 'b1111; // reset counter
132
        end else begin
137
        end else begin
133
            release out;
138
            release out;
134
        end
139
        end
135
    end
140
    end
136
 
141