Skip to content

Synthesis support for $countones? #4935

Discussion options

You must be logged in to vote

It appears to work for me

read_verilog <<EOF
module top (input [3:0] a, output [3:0] b);

assign b = $countones(a);

endmodule
EOF

synth

gives

...
2.25. Printing statistics.

=== top ===

   Number of wires:                  9
   Number of wire bits:             15
   Number of public wires:           2
   Number of public wire bits:       8
   Number of ports:                  2
   Number of port bits:              8
   Number of memories:               0
   Number of memory bits:            0
   Number of processes:              0
   Number of cells:                 10
     $_ANDNOT_                       2
     $_AND_                          1
     $_NOT_                          1
…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hankhsu1996
Comment options

Answer selected by hankhsu1996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants