summaryrefslogtreecommitdiffstats
path: root/tester/covoar/Target_lm32.cc
blob: 7babbd27c6ad284294fd9e155b1c237cb602e60a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*! @file Target_lm32.cc
 *  @brief Target_lm32 Implementation
 *
 *  This file contains the implementation of the base class for
 *  functions supporting target unique functionallity.
 */
#include "Target_lm32.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>

namespace Target {

  // http://www.latticesemi.com/documents/doc20890x45.pdf
  Target_lm32::Target_lm32( std::string targetName ):
    TargetBase( targetName )
  {
    conditionalBranchInstructions.push_back("be");
    conditionalBranchInstructions.push_back("bge");
    conditionalBranchInstructions.push_back("bgeu");
    conditionalBranchInstructions.push_back("bg");
    conditionalBranchInstructions.push_back("bgu");
    conditionalBranchInstructions.push_back("bne");
  }

  Target_lm32::~Target_lm32()
  {
  }

  bool Target_lm32::isNopLine(
    const std::string& line,
    int&               size
  )
  {
    if ( line.substr( line.length() - 3 ) == "nop" ) {
      size = 4;
      return true;
    }

    return false;
  }

  TargetBase *Target_lm32_Constructor(
    std::string          targetName
  )
  {
    return new Target_lm32( targetName );
  }

}