diff options
Diffstat (limited to 'tests/arch/ecp5/latches.v')
-rw-r--r-- | tests/arch/ecp5/latches.v | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/arch/ecp5/latches.v b/tests/arch/ecp5/latches.v new file mode 100644 index 000000000..adb5d5319 --- /dev/null +++ b/tests/arch/ecp5/latches.v @@ -0,0 +1,24 @@ +module latchp + ( input d, clk, en, output reg q ); + always @* + if ( en ) + q <= d; +endmodule + +module latchn + ( input d, clk, en, output reg q ); + always @* + if ( !en ) + q <= d; +endmodule + +module latchsr + ( input d, clk, en, clr, pre, output reg q ); + always @* + if ( clr ) + q <= 1'b0; + else if ( pre ) + q <= 1'b1; + else if ( en ) + q <= d; +endmodule |