This repository has been archived on 2023-12-21. You can view files and clone it, but cannot push or open issues or pull requests.
cse141L-project/RTL/Flags.sv

31 lines
625 B
Systemverilog
Raw Normal View History

2022-08-26 04:02:47 +00:00
// Module Name: Flags
// Project Name: CSE141L
// Description: flag registers
module Flags (
input logic Clk, Reset, WriteEn, start,
input logic Zero_in, Done_in,
output logic Zero_out, Done_out
);
logic Zero, Done;
assign Zero_out = Zero;
assign Done_out = Done;
always_ff @(posedge Clk) begin
if(Reset) begin
Zero <= 'b0;
Done <= 'b1; // default Done to halt machine
end
else if (start) begin
Zero <= Zero_in;
Done <= 'b0;
end
else if (WriteEn) begin
Zero <= Zero_in;
Done <= Done_in;
end
end
endmodule