Skip to content

Latest commit

 

History

History
57 lines (47 loc) · 927 Bytes

vcpop.adoc

File metadata and controls

57 lines (47 loc) · 927 Bytes

vcpop.v

Synopsis

Count the number of bits set in each element

Mnemonic

vcpop.v vd, vs2, vm

Encoding (Vector)
{reg:[
{bits: 7, name: 'OP-V'},
{bits: 5, name: 'vd'},
{bits: 3, name: 'OPMVV'},
{bits: 5, name: '01110'},
{bits: 5, name: 'vs2'},
{bits: 1, name: 'vm'},
{bits: 6, name: '010010'},
]}
Arguments
Register Direction Definition

Vs2

input

Input elements

Vd

output

Count of bits set

Description

A population count is performed on each element.

Operation
function clause execute (VCPOP(vs2)) = {

  foreach (i from vstart to vl-1) {
    let input = get_velem(vs2, SEW, i);
    let output : bits(SEW) = 0;
    for (j = 0; j < SEW;  j++)
      output = output + input[j];
    set_velem(vd, SEW, i, output)
  }
  RETIRE_SUCCESS
}
Included in

[zvbb]