Page MenuHomePhorge

branchingmux_binary_7.v
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

branchingmux_binary_7.v

module fsm (
input wire clk,
input wire reset,
input wire in1, in2,
output wire out
);
reg [2:0] state, next_state;
// Sequential block: state transitions on clock or reset
always @(posedge clk or posedge reset) begin
if (reset)
state <= 3'b000; // Reset state
else
state <= next_state;
end
// Combinational block: next state logic
always @(*) begin
case (state)
3'b000: next_state = in1 ? 3'b001 : 3'b010;
3'b001: next_state = in2 ? 3'b011 : 3'b100;
3'b010: next_state = 3'b101;
3'b011: next_state = 3'b000; // Loop back to initial state
3'b100: next_state = 3'b000; // Another loop to initial state
3'b101: next_state = 3'b000; // Terminal state back to initial
default: next_state = 3'b000; // Safe default for illegal states
endcase
end
// Combinational block: output logic
assign out = (state == 3'b101); // Output '1' only in state 101
endmodule

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 12, 4:35 AM (13 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
307619
Default Alt Text
branchingmux_binary_7.v (1 KB)

Event Timeline