Friday, 4 November 2016

3.Verilog code for gates( Behavioral ).

//Verilog code for AND gate Behavioural.
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:20:12 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    and_gate_beh
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Verilog code for AND gate
module   and_gate_beh (input_a,
                                    input_b,
    output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;
  reg     output_y;
//Declaration of AND Gate
  always @(*)begin
    if(( input_a == 1'b1)&&( input_b == 1'b1))begin
  output_y <= 1'b1;
   end else begin
  output_y <= 1'b0;
end
  end
endmodule

---------------------------------------------------------------------------------------------------------------


//Verilog code for OR gate Behavioural.
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:20:12 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    or_gate_beh
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Verilog code for OR gate
module  or_gate_beh (input_a,
                                  input_b,
  output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;
  reg     output_y;
//Declaration of OR Gate
  always @(*)begin
    if(( input_a == 1'b0) && (input_b == 1'b0))begin
  output_y <= 1'b0;
   end else begin
  output_y <= 1'b1;
end
  end
endmodule

--------------------------------------------------------------------------------------------------------------------

//Verilog code for NOT gate Behavioural.
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:20:12 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    not_gate_beh
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Verilog code for NOT gate
module   not_gate_beh (input_a,
     output_y);

//Inputs
  input  input_a;

//Output
  output  output_y;
  reg     output_y;
//Declaration of NOT Gate
  always @(*)begin
    if( input_a == 1'b0)begin
  output_y <= 1'b1;
   end else begin
  output_y <= 1'b0;
end
  end
endmodule


---------------------------------------------------------------------------------------------------------------------

//Verilog code for NAND gate Behavioural.
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:20:12 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    nand_gate_beh
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Verilog code for  NAND gate
module   nand_gate_beh (input_a,
                                        input_b,
        output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;
  reg     output_y;
//Declaration of NAND Gate
  always @(*)begin
    if( (input_a == 1'b1) && (input_b == 1'b1))begin
  output_y <= 1'b0;
   end else begin
  output_y <= 1'b1;
end
  end
endmodule

------------------------------------------------------------------------------------------------------------------------

//Verilog code for NOR gate Behavioural.
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:20:12 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    nor_gate_beh
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Verilog code for NOR gate
module   nor_gate_beh(input_a,
                                    input_b,
    output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;
  reg     output_y;
//Declaration of NOR Gate
  always @(*)begin
    if(( input_a == 1'b0) &&( input_b == 1'b0))begin
  output_y <= 1'b1;
   end else begin
  output_y <= 1'b0;
end
  end
endmodule

-----------------------------------------------------------------------------------------------------------------------
//Verilog code for XOR gate Behavioural.
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:20:12 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    xor_gate_beh
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Verilog code for XOR gate
module   xor_gate_beh(input_a,
                                    input_b,
    output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;
  reg     output_y;
//Declaration of XOR Gate
  always @(*)begin
    if( input_a == input_b)begin
  output_y <= 1'b0;
   end else begin
  output_y <= 1'b1;
end
  end
endmodule

-------------------------------------------------------------------------------------------------------------------------

//Verilog code for XNOR gate Behavioural.
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:20:12 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    xnor_gate_beh
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Verilog code for XNOR gate
module    xnor_gate_beh(input_a,
                                       input_b,
       output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;
  reg     output_y;
//Declaration of XNOR Gate
  always @(*)begin
    if( input_a == input_b)begin
  output_y <= 1'b1;
   end else begin
  output_y <= 1'b0;
end
  end
endmodule
-------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment