Experiment With FPGA (Field Programmable Gate Array) : Ans 1: 2-Bit Multiplier
Experiment With FPGA (Field Programmable Gate Array) : Ans 1: 2-Bit Multiplier
Experiment With FPGA (Field Programmable Gate Array) : Ans 1: 2-Bit Multiplier
Ans 1 :
`timescale 1ns / 1ps
module mult(out, x, y, clk);
input [1:0] x;
input[1:0] y;
input clk;
output reg [3:0] out;
always@(x or y)
begin
assign {out} = x*y;
end
endmodule
Timing Diagram:
2-bit multiplier
Ans 2:
`timescale 1ns / 1ps
module counter1( q,ip,clk);
input clk;
input [3:0]ip;
output [3:0] q;
reg [3:0] q;
integer count;
//wire [3:0] d_cntr;
initial begin
q[3:0] = 4'b0000;
count = 0;
end
always @ (posedge clk)
begin
count<=count+1;
if ((count%2)== 0)
begin
//count<=0;
if ( q[3:0] == ip)
q<=4'b0000;
else
//q <= d_cntr;
q<= q+1;
end
end
endmodule
Timing Diagram:
Divide Counter
Ans 3:
State Transition