Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions 3.Circuits/Combinational Logic/Basic Gates/optical_and_gate.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Optical AND Gate Implementation
//
// This module simulates an optical AND gate using Verilog.
// In optical computing, an AND gate can be implemented using:
// - Nonlinear optical materials (e.g., MoS2, GaAs)
// - Two input laser beams with binary encoding (0=no light, 1=light present)
// - The output is light only when both inputs have light (logical AND)
//
// Physical Implementation:
// - Input A and B are represented as optical signals (light intensity)
// - The gate uses nonlinear optical effects where two beams interact
// - Output light is produced only when both inputs are present
// - This can be achieved through four-wave mixing or cross-phase modulation

module optical_and_gate (
input wire A, // Optical Input A (0=no light, 1=light)
input wire B, // Optical Input B (0=no light, 1=light)
output wire Y // Optical Output Y (0=no light, 1=light)
);

// Logical AND operation: Y = A AND B
// In optical implementation:
// - Both beams must be present to generate output
// - Uses nonlinear optical interaction
assign Y = A & B;

endmodule
27 changes: 27 additions & 0 deletions 3.Circuits/Combinational Logic/Basic Gates/optical_or_gate.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Optical OR Gate Implementation
//
// This module simulates an optical OR gate using Verilog.
// In optical computing, an OR gate can be implemented using:
// - Beam combiners or optical couplers
// - Two input laser beams with binary encoding (0=no light, 1=light present)
// - The output has light when either or both inputs have light (logical OR)
//
// Physical Implementation:
// - Input A and B are represented as optical signals (light intensity)
// - The gate uses passive optical coupling or beam splitting
// - Output light is produced when at least one input is present
// - Can be implemented with Y-branch waveguides or directional couplers

module optical_or_gate (
input wire A, // Optical Input A (0=no light, 1=light)
input wire B, // Optical Input B (0=no light, 1=light)
output wire Y // Optical Output Y (0=no light, 1=light)
);

// Logical OR operation: Y = A OR B
// In optical implementation:
// - Either beam present generates output
// - Uses beam combiner or optical coupler
assign Y = A | B;

endmodule
55 changes: 55 additions & 0 deletions Test/optical_gates_testbench.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Testbench for Optical Logic Gates
//
// This testbench verifies the functionality of optical AND and OR gates

`timescale 1ns / 1ps

module optical_gates_testbench;

// Inputs
reg A;
reg B;

// Outputs
wire Y_and;
wire Y_or;

// Instantiate the optical AND gate
optical_and_gate uut_and (
.A(A),
.B(B),
.Y(Y_and)
);

// Instantiate the optical OR gate
optical_or_gate uut_or (
.A(A),
.B(B),
.Y(Y_or)
);

initial begin
// Display header
$display("=========================================");
$display("Optical Logic Gates Test");
$display("=========================================");
$display("Time\tA\tB\t|\tAND\tOR");
$display("-----------------------------------------");

// Monitor signals
$monitor("%0t\t%b\t%b\t|\t%b\t%b", $time, A, B, Y_and, Y_or);

// Test all input combinations
A = 0; B = 0; #10; // Both off
A = 0; B = 1; #10; // Only B on
A = 1; B = 0; #10; // Only A on
A = 1; B = 1; #10; // Both on

$display("=========================================");
$display("Test completed successfully!");
$display("=========================================");

$finish;
end

endmodule