File Coverage

blib/lib/CPU/x86_64/InstructionWriter/Unknown.pm
Criterion Covered Total %
statement 13 20 65.0
branch 2 8 25.0
condition 0 3 0.0
subroutine 5 7 71.4
pod 3 4 75.0
total 23 42 54.7


line stmt bran cond sub pod time code
1             package CPU::x86_64::InstructionWriter::Unknown;
2             our $VERSION = '0.001'; # VERSION
3 17     17   114 use strict;
  17         37  
  17         468  
4 17     17   87 use warnings;
  17         49  
  17         506  
5 17     17   143 use Carp;
  17         38  
  17         4971  
6              
7             # ABSTRACT: Placeholder for a constant that will be assembled
8              
9              
10             sub new {
11 54815     54815 0 182895 my ($class, %fields)= @_;
12 54815         320691 bless \%fields, $class;
13             }
14              
15 0 0   0 1 0 sub name { $_[0]{name}= $_[1] if @_ > 1; $_[0]{name} }
  0         0  
16              
17             sub bits {
18 0     0 1 0 my $self= shift;
19 0 0       0 return $self->{bits} unless @_;
20 0         0 my $val= shift;
21 0 0 0     0 !defined $self->{bits} || $self->{bits} == $val
22             or croak "Can't change bits from $self->{bits} to $val for unknown($self->{name})";
23 0         0 $self->{bits}= $val;
24             }
25              
26 30 100   30 1 97 sub value { $_[0]{value}= $_[1] if @_ > 1; $_[0]{value} }
  30         67  
27              
28             1;
29              
30             __END__