diff options
author | Andrew Zonenberg <azonenberg@drawersteak.com> | 2017-08-28 22:13:36 -0700 |
---|---|---|
committer | Andrew Zonenberg <azonenberg@drawersteak.com> | 2017-08-28 22:18:57 -0700 |
commit | 3fc1b9f3fdd7f5e8aca25b266cbfea90b519cc42 (patch) | |
tree | 65154c916f07ecac9d642c5b6a3cbdb0d7c9ef85 /techlibs | |
parent | 46b01f05bba64a8dc42f0e34f767e7aa44b43a06 (diff) | |
download | yosys-3fc1b9f3fdd7f5e8aca25b266cbfea90b519cc42.tar.gz yosys-3fc1b9f3fdd7f5e8aca25b266cbfea90b519cc42.tar.bz2 yosys-3fc1b9f3fdd7f5e8aca25b266cbfea90b519cc42.zip |
Finished refactoring counter extraction to be nice and generic. Implemented techmapping from $__COUNT_ to GP_COUNTx cells.
Diffstat (limited to 'techlibs')
-rw-r--r-- | techlibs/greenpak4/cells_map.v | 68 | ||||
-rw-r--r-- | techlibs/greenpak4/synth_greenpak4.cc | 2 |
2 files changed, 69 insertions, 1 deletions
diff --git a/techlibs/greenpak4/cells_map.v b/techlibs/greenpak4/cells_map.v index f8fb2569a..1450eac2e 100644 --- a/techlibs/greenpak4/cells_map.v +++ b/techlibs/greenpak4/cells_map.v @@ -144,3 +144,71 @@ module \$lut (A, Y); end endgenerate endmodule + +module \$__COUNT_ (CE, CLK, OUT, POUT, RST, UP); + + input wire CE; + input wire CLK; + output reg OUT; + output reg[WIDTH-1:0] POUT; + input wire RST; + input wire UP; + + parameter COUNT_TO = 1; + parameter RESET_MODE = "RISING"; + parameter HAS_POUT = 0; + parameter HAS_CE = 0; + parameter WIDTH = 8; + parameter DIRECTION = "DOWN"; + + //If we have a CE, or DIRECTION other than DOWN fail... GP_COUNTx_ADV is not supported yet + if(HAS_CE || (DIRECTION != "DOWN") ) begin + initial begin + $display("ERROR: \$__COUNT__ support for GP_COUNTx_ADV is not yet implemented. This counter should never have been extracted (bug in extract_counter pass?)."); + $finish; + end + end + + //If counter is more than 14 bits wide, complain (also shouldn't happen) + else if(WIDTH > 14) begin + initial begin + $display("ERROR: \$__COUNT__ support for cascaded counters is not yet implemented. This counter should never have been extracted (bug in extract_counter pass?)."); + $finish; + end + end + + //If counter is more than 8 bits wide and has parallel output, we have a problem + else if(WIDTH > 8 && HAS_POUT) begin + initial begin + $display("ERROR: \$__COUNT__ support for 9-14 bit counters with parallel output is not yet implemented. This counter should never have been extracted (bug in extract_counter pass?)."); + $finish; + end + end + + //Looks like a legal counter! Do something with it + else if(WIDTH <= 8) begin + GP_COUNT8 #( + .COUNT_TO(COUNT_TO), + .RESET_MODE(RESET_MODE), + .CLKIN_DIVIDE(1) + ) _TECHMAP_REPLACE_ ( + .CLK(CLK), + .RST(RST), + .OUT(OUT), + .POUT(POUT) + ); + end + + else begin + GP_COUNT14 #( + .COUNT_TO(COUNT_TO), + .RESET_MODE(RESET_MODE), + .CLKIN_DIVIDE(1) + ) _TECHMAP_REPLACE_ ( + .CLK(CLK), + .RST(RST), + .OUT(OUT) + ); + end + +endmodule diff --git a/techlibs/greenpak4/synth_greenpak4.cc b/techlibs/greenpak4/synth_greenpak4.cc index 1fb99c348..56ea8003e 100644 --- a/techlibs/greenpak4/synth_greenpak4.cc +++ b/techlibs/greenpak4/synth_greenpak4.cc @@ -155,7 +155,7 @@ struct SynthGreenPAK4Pass : public ScriptPass if (check_label("fine")) { - run("extract_counter"); + run("extract_counter -pout \\GP_DCMP,\\GP_DAC -maxwidth 14"); run("clean"); run("opt -fast -mux_undef -undriven -fine"); run("memory_map"); |