Professional Documents
Culture Documents
ELD Quiz2 Solutions
ELD Quiz2 Solutions
ELD Quiz2 Solutions
Design a 1-12 counter (counter which counts from 1 to 12) with the following inputs
and outputs:
3 Marks
Solution 1 :
module top_mod12(
input reset,
input enable,
input clk,
output [3:0] q
);
//If reset is 0, the counter register will take the next count value
begin
if (reset == 1'b1)
count_reg <=1;
else
end
//Combinational always block
else
count_next = 1; // The counter is set to initial value 1, when the count reaches 12
else
end
assign q = count_reg;
endmodule
Marking Criteria :
Rubric:
● 1 Mark for Correct Switch case
○ If switch case is incorrect then 0
● 1 Mark for correct output condition
○ If output always block incorrect then 0
● 1 Mark correct syntax
○ If syntax is not correct then 0.
Verilog Code
module parity(
input [35:0] Data_in,
output reg [31:0] Data_out,
output reg Data_status
);
wire [3:0] parity; // Vector containing parity bits of each byte of input data
endmodule
Evaluation Criteria
● Correct output for Data_status flag: 1
● Correct output for Data_out: 1
● Correct parity bit generation: 1