Published
Edited
Jul 15, 2019
Insert cell
Insert cell
Insert cell
coreText = d3.text(repoInfo2.repo.replace('github.com', 'raw.githubusercontent.com')+'/'+repoInfo2.branch+'/'+repoInfo2.core)
Insert cell
targetInfo = coreInfo.targets[repoInfo2.target];
Insert cell
coreInfo = yaml.safeLoad(coreText.substring(coreText.indexOf("\n") + 1));
Insert cell
fileList2 = {
let files = []
targetInfo.filesets.forEach( fileset => files = files.concat(coreInfo.filesets[fileset].files));
files = files.map( f => {
if (typeof f === "object") {
return f;
} else {
const ret = {}
ret[f] = {is_include_file: false}
return ret;
}
});
return files
}
Insert cell
Insert cell
Insert cell
Insert cell
/* updateFileInputForm = {
d3.select((viewof f).childNodes[0])
.selectAll("input")
.data(d3.range(repoInfo.numFiles))
.join(
enter => enter
.append("div")
.append("input")
.attr("name", index => "in_" + index)
)
}*/
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
yosys_execution = {
let mkdirIfNotPresent = (dirName, parentName) => {
let locals = ys.read_dir(parentName);
if (!locals.includes(dirName)) {
ys.window.FS.mkdir(parentName + dirName);
}
}
print_buf.textContent = ''
fileList2.forEach( (file, i) => {
let fname = Object.keys(file)[0];
print_buf.textContent += `write file: ${fname}\n`;
let dirs = fname.split('/')
dirs.pop()
dirs.forEach( d => {
mkdirIfNotPresent(d, './')
ys.window.FS.chdir(d);
});
dirs.forEach( d => ys.window.FS.chdir('..'));
ys.write_file(fname, textStrs[i]);
});
ys.run('design -reset')
print_buf.textContent += ys.print_buffer
fileList2.forEach( (file, i) => {
let fname = Object.keys(file)[0];
if (file[fname].is_include_file) return;
ys.run('read_verilog -defer ' + fname);
print_buf.textContent += ys.print_buffer
});
mkdirIfNotPresent('shareice40','/')
let cells_sim = d3.text('https://raw.githubusercontent.com/YosysHQ/yosys/master/techlibs/ice40/cells_sim.v')
ys.write_file('/shareice40/cells_sim.v', cells_sim);
let brams_text = d3.text('https://raw.githubusercontent.com/YosysHQ/yosys/master/techlibs/ice40/brams.txt')
ys.write_file('/shareice40/brams.txt', brams_text);
let brams_map = d3.text('https://raw.githubusercontent.com/YosysHQ/yosys/master/techlibs/ice40/brams_map.v')
ys.write_file('/shareice40/brams_map.v', brams_map);
let arith_map = d3.text('https://raw.githubusercontent.com/YosysHQ/yosys/master/techlibs/ice40/arith_map.v')
ys.write_file('/shareice40/arith_map.v', arith_map);
ys.run('read_verilog -lib /shareice40/cells_sim.v');
print_buf.textContent += ys.print_buffer
ys.run(`hierarchy -check -top ${targetInfo.toplevel}`);
print_buf.textContent += ys.print_buffer
ys.run('synth -run coarse')
print_buf.textContent += ys.print_buffer
ys.run('memory_bram -rules /shareice40/brams.txt; techmap -map /shareice40/brams_map.v')
print_buf.textContent += ys.print_buffer
ys.run("opt -fast -mux_undef -undriven -fine; memory_map; opt -undriven -fine");
print_buf.textContent += ys.print_buffer
ys.run("techmap -map +/tech_map.v");
print_buf.textContent += ys.print_buffer
}
Insert cell
yaml = require("js-yaml@3.12.0/dist/js-yaml.js")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more