isa_parser.py (4185:42c0395a03f9) isa_parser.py (4273:449c6e09f6ca)
1# Copyright (c) 2003-2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

358def p_def_bitfield_1(t):
359 'def_bitfield : DEF opt_signed BITFIELD ID LESS INTLIT GREATER SEMI'
360 expr = 'bits(machInst, %2d, %2d)' % (t[6], t[6])
361 if (t[2] == 'signed'):
362 expr = 'sext<%d>(%s)' % (1, expr)
363 hash_define = '#undef %s\n#define %s\t%s\n' % (t[4], t[4], expr)
364 t[0] = GenCode(header_output = hash_define)
365
1# Copyright (c) 2003-2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

358def p_def_bitfield_1(t):
359 'def_bitfield : DEF opt_signed BITFIELD ID LESS INTLIT GREATER SEMI'
360 expr = 'bits(machInst, %2d, %2d)' % (t[6], t[6])
361 if (t[2] == 'signed'):
362 expr = 'sext<%d>(%s)' % (1, expr)
363 hash_define = '#undef %s\n#define %s\t%s\n' % (t[4], t[4], expr)
364 t[0] = GenCode(header_output = hash_define)
365
366# alternate form for structure member: 'def bitfield <ID> <ID>'
367def p_def_bitfield_2(t):
368 'def_bitfield : DEF nothing BITFIELD ID ID SEMI'
369 expr = 'machInst.%s' % t[5]
370 hash_define = '#undef %s\n#define %s\t%s\n' % (t[4], t[4], expr)
371 t[0] = GenCode(header_output = hash_define)
372
373def p_nothing(t):
374 'nothing : empty'
375 t[0] = ''
376
366def p_opt_signed_0(t):
367 'opt_signed : SIGNED'
368 t[0] = t[1]
369
370def p_opt_signed_1(t):
371 'opt_signed : empty'
372 t[0] = ''
373

--- 1520 unchanged lines hidden ---
377def p_opt_signed_0(t):
378 'opt_signed : SIGNED'
379 t[0] = t[1]
380
381def p_opt_signed_1(t):
382 'opt_signed : empty'
383 t[0] = ''
384

--- 1520 unchanged lines hidden ---