


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions and problems for a digital logic design homework assignment. The assignment includes drawing schematics, writing verilog descriptions, and designing various digital circuits such as decoders, arithmetic blocks, and counters. The circuits must meet specifications and be tested using simulation results.
Typology: Assignments
1 / 4
This page cannot be seen from the preview
Don't miss anything!



// inputs input [3:0] A, B;
// outputs output [3:0] O;
// identifiers wire cl, cg, ce; reg [1:0] e; reg [3:0] O;
/* Functionality */ assign cl = (A < B); assign ce = (A == B);
assign cg = (A > B);
always @(cg or ce or cl) case( {1'b0,cg,ce,cl} ) 4'b0001: e <= 2'b00; 4'b0010: e <= 2'b01; 4'b0100: e <= 2'b10; 4'b1000: e <= 2'b11; default: e <= 2'b00; endcase
always @(e or A or B) if( e == 2'b00 ) O <= B; else if( e == 2'b01 ) O <= ~A; else if( e == 2'b10 ) O <= A; else O <= 4'b0000;
endmodule