FDP Assignment Solutions
FDP Assignment Solutions
When 12 bytes are received, compare it with the fixed input value. If it
matches, generate a pulse output. Draw timing diagram and design optimized
digital circuit of it.
Serial Input --> Shift Register (8-bit SIPO) --> Storage (96-bit
register)
|
v
Comparator --> Pulse Generator -->
Output
2. Generate the below phase-1, phase-2 and phase-3 output where frequency
of each phase-X (X=1,2,3) CLK/20 of CLK of input CLK.
3. Create a calculator which do + and -. Assume two numbers are 9bit wide.
Full Adder:
module full_adder(
input a,
input b,
input cin,
output sum,
output cout
);
endmodule
9-bit Adder:
module nine_bit_adder(
input [8:0] a,
input [8:0] b,
output [8:0] result,
output carry_out
);
endmodule
9-bit Subtractor:
module nine_bit_subtractor(
input [8:0] a,
input [8:0] b,
output [8:0] result,
output borrow_out
);
endmodule
Calculator:
module calculator(
input [8:0] num1,
input [8:0] num2,
input op, // '0' for addition, '1' for subtraction
output reg [8:0] result,
output reg valid_output
);
endmodule
module multiply_by_6(
input [9:0] data_in,
output reg [15:0] result
);
always @* begin
mult_by_4 = data_in << 2; // Multiply by 4 (left shift
by 2)
mult_by_2 = data_in << 1; // Multiply by 2 (left shift
by 1)
result = mult_by_4 + mult_by_2; // Multiply by 6
end
endmodule
5. There is a 8bit incoming data, and other input are reg_sel, sel and chk which
are one bit input along with data, this data has be captured as below logic.
• If reg_sel is set to 0, data needs to be loaded in register when sel
input is 1, chk is don’t care.
• If reg_sel is set to 1, then data need to be loaded in register when
sel and chk input is 1
Reg, sel and chk can change at any time.
module data_capture(
);
reg prev_reg_sel;
reg prev_sel;
reg prev_chk;
end
end
endmodule