2023-01-11 10:13:09 +00:00
|
|
|
/**
|
|
|
|
* 1-bit register:
|
|
|
|
* If load[t] == 1 then out[t+1] = in[t]
|
|
|
|
* else out does not change (out[t+1] = out[t])
|
|
|
|
*/
|
|
|
|
|
|
|
|
`default_nettype none
|
|
|
|
module Bit(
|
2024-10-17 18:36:58 +00:00
|
|
|
input clk,
|
|
|
|
input in,
|
|
|
|
input load,
|
|
|
|
output out
|
2023-01-11 10:13:09 +00:00
|
|
|
);
|
|
|
|
|
2024-10-17 18:36:58 +00:00
|
|
|
// Put your code here:
|
|
|
|
wire muxout;
|
|
|
|
// Mux(a=dffout, b=in, sel=load, out=muxout);
|
|
|
|
// DFF(in=muxout, out=out, out=dffout);
|
|
|
|
Mux MUX(out, in, load, muxout);
|
|
|
|
DFF DFF(clk, muxout, out);
|
2023-01-11 10:13:09 +00:00
|
|
|
endmodule
|