Subversion Repositories programming

Rev

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

Rev 195 Rev 197
Line 171... Line 171...
171
    /* MUX the output together */
171
    /* MUX the output together */
172
    Mux4 resMux (w_and, w_or, w_add_out, w_add_out, op, result);
172
    Mux4 resMux (w_and, w_or, w_add_out, w_add_out, op, result);
173
 
173
 
174
endmodule
174
endmodule
175
 
175
 
176
/*
-
 
177
module test_oba;
-
 
178
 
-
 
179
    reg a, b, cin;
-
 
180
    wire w_cout, w_result;
-
 
181
 
-
 
182
    OneBitAdder oba (cin, a, b, w_cout, w_result);
-
 
183
 
-
 
184
    initial begin
-
 
185
        $monitor ("time=%0d a=%b b=%b cin=%b cout=%b result=%b",
-
 
186
            $time, a, b, cin, w_cout, w_result);
-
 
187
    end
-
 
188
 
-
 
189
    initial begin
-
 
190
           a=0; b=0; cin=0;
-
 
191
        #1 a=0; b=0; cin=1;
-
 
192
        #1 a=0; b=1; cin=0;
-
 
193
        #1 a=0; b=1; cin=1;
-
 
194
        #1 a=1; b=0; cin=0;
-
 
195
        #1 a=1; b=0; cin=1;
-
 
196
        #1 a=1; b=1; cin=0;
-
 
197
        #1 a=1; b=1; cin=1;
-
 
198
    end
-
 
199
 
-
 
200
endmodule
-
 
201
*/
-
 
202
/*
-
 
203
module test_alu1;
-
 
204
 
-
 
205
    reg a, b, cin;
-
 
206
    reg[0:1] op;
-
 
207
    wire cout, result;
-
 
208
 
-
 
209
    ALU1 alu1 (a, b, cin, op, cout, result);
-
 
210
 
-
 
211
    initial begin
-
 
212
        $monitor ("time=%0d a=%b b=%b op=%b cin=%b cout=%b result=%b",
-
 
213
            $time, a, b, op, cin, cout, result);
-
 
214
    end
-
 
215
 
-
 
216
    initial begin
-
 
217
           a=0; b=0; cin=0; op=00; $display; $display("AND");
-
 
218
        #1 a=0; b=0; cin=1; op=00;
-
 
219
        #1 a=0; b=1; cin=0; op=00;
-
 
220
        #1 a=0; b=1; cin=1; op=00;
-
 
221
        #1 a=1; b=0; cin=0; op=00;
-
 
222
        #1 a=1; b=0; cin=1; op=00;
-
 
223
        #1 a=1; b=1; cin=0; op=00;
-
 
224
        #1 a=1; b=1; cin=1; op=00;
-
 
225
 
-
 
226
        #1 a=0; b=0; cin=0; op=01; $display; $display ("OR");
-
 
227
        #1 a=0; b=0; cin=1; op=01;
-
 
228
        #1 a=0; b=1; cin=0; op=01;
-
 
229
        #1 a=0; b=1; cin=1; op=01;
-
 
230
        #1 a=1; b=0; cin=0; op=01;
-
 
231
        #1 a=1; b=0; cin=1; op=01;
-
 
232
        #1 a=1; b=1; cin=0; op=01;
-
 
233
        #1 a=1; b=1; cin=1; op=01;
-
 
234
 
-
 
235
        #1 a=0; b=0; cin=0; op=10; $display; $display ("ADD");
-
 
236
        #1 a=0; b=0; cin=1; op=10;
-
 
237
        #1 a=0; b=1; cin=0; op=10;
-
 
238
        #1 a=0; b=1; cin=1; op=10;
-
 
239
        #1 a=1; b=0; cin=0; op=10;
-
 
240
        #1 a=1; b=0; cin=1; op=10;
-
 
241
        #1 a=1; b=1; cin=0; op=10;
-
 
242
        #1 a=1; b=1; cin=1; op=10;
-
 
243
 
-
 
244
        #1 a=0; b=0; cin=0; op=11; $display; $display ("SUB");
-
 
245
        #1 a=0; b=0; cin=1; op=11;
-
 
246
        #1 a=0; b=1; cin=0; op=11;
-
 
247
        #1 a=0; b=1; cin=1; op=11;
-
 
248
        #1 a=1; b=0; cin=0; op=11;
-
 
249
        #1 a=1; b=0; cin=1; op=11;
-
 
250
        #1 a=1; b=1; cin=0; op=11;
-
 
251
        #1 a=1; b=1; cin=1; op=11;
-
 
252
    end
-
 
253
 
-
 
254
endmodule
-
 
255
*/
-