-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcram-defs.js
More file actions
25 lines (21 loc) · 836 Bytes
/
cram-defs.js
File metadata and controls
25 lines (21 loc) · 836 Bytes
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
// Read `define.mic` and gather CRAM and DRAM fields and constants.
'use strict';
const fs = require('fs');
// Split `define.mic` file to retrieve CRAM definitions section and
// DRAM definitions sections so we can parse them into definitions we
// can use.
const definesRE = new RegExp([
/^.*\.TOC\s+"CONTROL RAM DEFINITIONS -- J, AD"\s+/,
/(?<CRAM>.*?)(?=\.DCODE\s+)/,
/(?<DRAM>.*?)(?=\s+\.UCODE\s+)/,
].map(re => re.source).join(''), 'ms');
const define_mic = fs.readFileSync('kl10-source/define.mic');
if (!define_mic) {
console.error(`ERROR: Missing 'define.mic' file which is required for EBOX`);
process.exit(-1);
}
const definesMatches = define_mic
.toString()
.match(definesRE);
module.exports.CRAMdefinitions = definesMatches.groups.CRAM;
module.exports.DRAMdefinitions = definesMatches.groups.DRAM;