Friday, 4 November 2016

1.Verilog code for gates(Data flow).

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

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;

//Declaration of AND Gate

  assign  output_y  = (input_a) & (input_b);

endmodule


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

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;

//Declaration of OR Gate

   assign  output_y = (input_a) | (input_b);
 
endmodule


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

//Inputs
  input  input_a;

//Output
  output  output_y;

//Declaration of NOT Gate

  assign  output_y  = ~(input_a);

endmodule




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

//Inputs
  input    input_a;
  input    input_b;

//Output
  output   output_y;

//Declaration of OR Gate

   assign  output_y = ~((input_a) | (input_b));
 
endmodule  



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

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;

//Declaration of NAND Gate

  assign  output_y = ~(input_a & input_b);

endmodule




//Verilog code for XOR gate
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:57:04 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    xor_gate_code
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////

module xor_gate_code(input_a,
                                      input_b,
      output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;

//Declaration of XOR Gate

   assign  output_y = (input_a) ^ (input_b);
 
endmodule



//Verilog code for XNOR gate
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RED_BLUE
// Engineer:
//
// Create Date:    17:57:04 11/04/2016
// Designer Name:  Madhu Krishna
// Module Name:    xnor_gate_code
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////

module xnor_gate_code(input_a,
                                        input_b,
       output_y);

//Inputs
  input  input_a;
  input  input_b;

//Output
  output  output_y;

//Declaration of XNOR Gate

   assign  output_y = ~((input_a) ^ (input_b));
 
endmodule  

No comments:

Post a Comment