mem.isa (7133:4a1af4580b7d) mem.isa (7205:e3dfcdf19561)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2010 ARM Limited
4// All rights reserved
5//
6// The license below extends only to copyright in the software and shall
7// not be construed as granting a license to any other intellectual
8// property including but not limited to intellectual property relating

--- 24 unchanged lines hidden (view full) ---

33// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Authors: Gabe Black
39
40let {{
1// -*- mode:c++ -*-
2
3// Copyright (c) 2010 ARM Limited
4// All rights reserved
5//
6// The license below extends only to copyright in the software and shall
7// not be construed as granting a license to any other intellectual
8// property including but not limited to intellectual property relating

--- 24 unchanged lines hidden (view full) ---

33// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Authors: Gabe Black
39
40let {{
41 def loadStoreBase(name, Name, imm, eaCode, accCode, memFlags,
42 instFlags, base = 'Memory', execTemplateBase = ''):
41 def loadStoreBaseWork(name, Name, imm, swp, codeBlobs, memFlags,
42 instFlags, base = 'Memory', execTemplateBase = ''):
43 # Make sure flags are in lists (convert to lists if not).
44 memFlags = makeList(memFlags)
45 instFlags = makeList(instFlags)
46
43 # Make sure flags are in lists (convert to lists if not).
44 memFlags = makeList(memFlags)
45 instFlags = makeList(instFlags)
46
47 eaCode = codeBlobs["ea_code"]
48
47 # This shouldn't be part of the eaCode, but until the exec templates
48 # are converted over it's the easiest place to put it.
49 eaCode += '\n unsigned memAccessFlags = '
50 if memFlags:
51 eaCode += (string.join(memFlags, '|') + ';')
52 else:
53 eaCode += '0;'
54
49 # This shouldn't be part of the eaCode, but until the exec templates
50 # are converted over it's the easiest place to put it.
51 eaCode += '\n unsigned memAccessFlags = '
52 if memFlags:
53 eaCode += (string.join(memFlags, '|') + ';')
54 else:
55 eaCode += '0;'
56
55 iop = InstObjParams(name, Name, base,
56 {'ea_code': eaCode,
57 'memacc_code': accCode,
58 'predicate_test': predicateTest},
59 instFlags)
57 codeBlobs["ea_code"] = eaCode
60
58
59 iop = InstObjParams(name, Name, base, codeBlobs, instFlags)
60
61 fullExecTemplate = eval(execTemplateBase + 'Execute')
62 initiateAccTemplate = eval(execTemplateBase + 'InitiateAcc')
63 completeAccTemplate = eval(execTemplateBase + 'CompleteAcc')
64
61 fullExecTemplate = eval(execTemplateBase + 'Execute')
62 initiateAccTemplate = eval(execTemplateBase + 'InitiateAcc')
63 completeAccTemplate = eval(execTemplateBase + 'CompleteAcc')
64
65 if imm:
65 if swp:
66 declareTemplate = SwapDeclare
67 constructTemplate = SwapConstructor
68 elif imm:
66 declareTemplate = LoadStoreImmDeclare
67 constructTemplate = LoadStoreImmConstructor
68 else:
69 declareTemplate = LoadStoreRegDeclare
70 constructTemplate = LoadStoreRegConstructor
71
72 # (header_output, decoder_output, decode_block, exec_output)
73 return (declareTemplate.subst(iop),
74 constructTemplate.subst(iop),
75 fullExecTemplate.subst(iop)
76 + initiateAccTemplate.subst(iop)
77 + completeAccTemplate.subst(iop))
78
69 declareTemplate = LoadStoreImmDeclare
70 constructTemplate = LoadStoreImmConstructor
71 else:
72 declareTemplate = LoadStoreRegDeclare
73 constructTemplate = LoadStoreRegConstructor
74
75 # (header_output, decoder_output, decode_block, exec_output)
76 return (declareTemplate.subst(iop),
77 constructTemplate.subst(iop),
78 fullExecTemplate.subst(iop)
79 + initiateAccTemplate.subst(iop)
80 + completeAccTemplate.subst(iop))
81
82 def loadStoreBase(name, Name, imm, eaCode, accCode, memFlags,
83 instFlags, base = 'Memory', execTemplateBase = ''):
84 codeBlobs = { "ea_code": eaCode,
85 "memacc_code": accCode,
86 "predicate_test": predicateTest }
87 return loadStoreBaseWork(name, Name, imm, False, codeBlobs, memFlags,
88 instFlags, base, execTemplateBase)
89
90 def SwapBase(name, Name, eaCode, preAccCode, postAccCode, memFlags,
91 instFlags):
92 codeBlobs = { "ea_code": eaCode,
93 "preacc_code": preAccCode,
94 "postacc_code": postAccCode,
95 "predicate_test": predicateTest }
96 return loadStoreBaseWork(name, Name, False, True, codeBlobs, memFlags,
97 instFlags, 'Swap', 'Swap')
98
79 def memClassName(base, post, add, writeback, \
80 size=4, sign=False, user=False):
81 Name = base
82
83 if post:
84 Name += '_PY'
85 else:
86 Name += '_PN'

--- 55 unchanged lines hidden ---
99 def memClassName(base, post, add, writeback, \
100 size=4, sign=False, user=False):
101 Name = base
102
103 if post:
104 Name += '_PY'
105 else:
106 Name += '_PN'

--- 55 unchanged lines hidden ---