Skip to content

Commit

Permalink
Merge pull request #6 from LvNA-system/bump-py3
Browse files Browse the repository at this point in the history
emu: bump py scripts to py3
  • Loading branch information
Wonicon authored Nov 4, 2020
2 parents 3e1e0de + d6bd719 commit 530388e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions fpga/emu/gen_nohype_dtb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from pyfdt.pyfdt import *
from sys import *
import os
Expand All @@ -12,7 +12,7 @@ def remove_cpus(fdt, nTiles):

def split_memory(fdt, nTiles):
mem = fdt.resolve_path('/memory@100000000/reg')
mem.words[-1] = mem.words[-1] / nTiles
mem.words[-1] = mem.words[-1] // nTiles

def remove_serial(fdt, nTiles, hartid):
soc = fdt.resolve_path('/soc')
Expand All @@ -23,7 +23,7 @@ def remove_serial(fdt, nTiles, hartid):
def remove_interrupt(fdt, nTiles):
for dev in int_dev:
prop = fdt.resolve_path('/soc/' + dev + '/interrupts-extended')
prop.words = prop.words[:len(prop.words)/nTiles]
prop.words = prop.words[:len(prop.words) // nTiles]

def insert_nohype_index(fdt, hartid):
for dev in int_dev:
Expand Down
6 changes: 3 additions & 3 deletions fpga/emu/mem_init
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import json
Expand Down Expand Up @@ -39,9 +39,9 @@ class MemInitGen:
print('initial begin')
for i in range(self.n_tiles):
print('$readmemh("{0}", ram, \'h{1});'
.format(self.bin_file, hex(self.mem_size / self.n_tiles / 8 * i)[2:]));
.format(self.bin_file, hex(self.mem_size // self.n_tiles // 8 * i)[2:]));
print('$readmemh("{0}", ram, \'h{1});'
.format('c' + str(i) + '.dtb.txt', hex(self.mem_size / self.n_tiles / 8 * i + 1)[2:]));
.format('c' + str(i) + '.dtb.txt', hex(self.mem_size // self.n_tiles // 8 * i + 1)[2:]));
print('end')
elif line.startswith(self.MODULE_END):
self.state = MemInitGen.NORMAL
Expand Down
19 changes: 10 additions & 9 deletions fpga/emu/py-check.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env bash

if ! which python
if ! which python3
then
echo python not found, please input password to allow apt-get to go forward
sudo apt-get install -y python
echo python3 not found, please input password to allow apt-get to go forward
sudo apt-get install -y python3
else
echo python installed
echo python3 installed
fi

if ! which pip
if ! which pip3
then
echo python-pip not found, please input password to allow apt-get to go forward
sudo apt-get install -y python-pip
echo python3-pip not found, please input password to allow apt-get to go forward
sudo apt-get install -y python3-pip
else
echo python-pip installed
fi

if ! python -c 'import pyfdt' 2> /dev/null
if ! python3 -c 'import pyfdt' 2> /dev/null
then
sudo -H pip install pyfdt
echo pyfdt package not found, please input password to allow pip3 to go forward
sudo -H pip3 install pyfdt
else
echo python module pyfdt installed
fi

0 comments on commit 530388e

Please sign in to comment.