mirror of
https://github.com/YosysHQ/sby.git
synced 2025-04-12 16:28:17 +00:00
Merge branch 'master' of https://github.com/YosysHQ/SymbiYosys
This commit is contained in:
commit
94ce8e1288
1
docs/examples/puzzles/.gitignore
vendored
1
docs/examples/puzzles/.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
/primegen_primegen
|
/primegen_primegen
|
||||||
/primegen_primes_pass
|
/primegen_primes_pass
|
||||||
/primegen_primes_fail
|
/primegen_primes_fail
|
||||||
|
/djb2hash
|
||||||
|
|
14
docs/examples/puzzles/djb2hash.sby
Normal file
14
docs/examples/puzzles/djb2hash.sby
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[options]
|
||||||
|
mode bmc
|
||||||
|
expect fail
|
||||||
|
|
||||||
|
[engines]
|
||||||
|
smtbmc yices
|
||||||
|
|
||||||
|
[script]
|
||||||
|
read -noverific
|
||||||
|
read -sv djb2hash.sv
|
||||||
|
prep -top djb2hash
|
||||||
|
|
||||||
|
[files]
|
||||||
|
djb2hash.sv
|
13
docs/examples/puzzles/djb2hash.sv
Normal file
13
docs/examples/puzzles/djb2hash.sv
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// find a hash collision for DJB2 hash where it visits the same state twice
|
||||||
|
module djb2hash (input clock);
|
||||||
|
(* keep *) rand const reg [31:0] magic;
|
||||||
|
(* keep *) rand reg [7:0] inputval;
|
||||||
|
(* keep *) reg [31:0] state = 5381;
|
||||||
|
(* keep *) integer cnt = 0;
|
||||||
|
|
||||||
|
always @(posedge clock) begin
|
||||||
|
state <= ((state << 5) + state) ^ inputval;
|
||||||
|
if (state == magic) cnt <= cnt + 1;
|
||||||
|
assert (cnt < 2);
|
||||||
|
end
|
||||||
|
endmodule
|
|
@ -17,7 +17,7 @@
|
||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
|
|
||||||
import argparse, os, sys, shutil, tempfile
|
import argparse, os, sys, shutil, tempfile, re
|
||||||
##yosys-sys-path##
|
##yosys-sys-path##
|
||||||
from sby_core import SbyJob, SbyAbort, process_filename
|
from sby_core import SbyJob, SbyAbort, process_filename
|
||||||
from time import localtime
|
from time import localtime
|
||||||
|
@ -149,6 +149,7 @@ def early_log(workdir, msg):
|
||||||
def read_sbyconfig(sbydata, taskname):
|
def read_sbyconfig(sbydata, taskname):
|
||||||
cfgdata = list()
|
cfgdata = list()
|
||||||
tasklist = list()
|
tasklist = list()
|
||||||
|
task_matched = False
|
||||||
|
|
||||||
pycode = None
|
pycode = None
|
||||||
tasks_section = False
|
tasks_section = False
|
||||||
|
@ -159,7 +160,7 @@ def read_sbyconfig(sbydata, taskname):
|
||||||
|
|
||||||
def handle_line(line):
|
def handle_line(line):
|
||||||
nonlocal pycode, tasks_section, task_tags_active, task_tags_all
|
nonlocal pycode, tasks_section, task_tags_active, task_tags_all
|
||||||
nonlocal task_skip_block, task_skiping_blocks
|
nonlocal task_skip_block, task_skiping_blocks, task_matched
|
||||||
|
|
||||||
line = line.rstrip("\n")
|
line = line.rstrip("\n")
|
||||||
line = line.rstrip("\r")
|
line = line.rstrip("\r")
|
||||||
|
@ -230,11 +231,23 @@ def read_sbyconfig(sbydata, taskname):
|
||||||
return
|
return
|
||||||
line = line.split()
|
line = line.split()
|
||||||
if len(line) > 0:
|
if len(line) > 0:
|
||||||
tasklist.append(line[0])
|
tname = line[0]
|
||||||
for t in line:
|
tpattern = False
|
||||||
if taskname == line[0]:
|
for c in tname:
|
||||||
task_tags_active.add(t)
|
if c in "(?*.[]|)":
|
||||||
task_tags_all.add(t)
|
tpattern = True
|
||||||
|
if not tpattern:
|
||||||
|
tasklist.append(tname)
|
||||||
|
task_tags_all.add(tname)
|
||||||
|
if taskname is not None and re.fullmatch(tname, taskname):
|
||||||
|
task_matched = True
|
||||||
|
task_tags_active.add(tname)
|
||||||
|
for t in line[1:]:
|
||||||
|
task_tags_active.add(t)
|
||||||
|
task_tags_all.add(t)
|
||||||
|
else:
|
||||||
|
for t in line[1:]:
|
||||||
|
task_tags_all.add(t)
|
||||||
|
|
||||||
elif line == "[tasks]":
|
elif line == "[tasks]":
|
||||||
if taskname is None:
|
if taskname is None:
|
||||||
|
@ -247,6 +260,10 @@ def read_sbyconfig(sbydata, taskname):
|
||||||
for line in sbydata:
|
for line in sbydata:
|
||||||
handle_line(line)
|
handle_line(line)
|
||||||
|
|
||||||
|
if taskname is not None and not task_matched:
|
||||||
|
print("ERROR: Task name '{}' didn't match any lines in [tasks].".format(taskname), file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
return cfgdata, tasklist
|
return cfgdata, tasklist
|
||||||
|
|
||||||
|
|
||||||
|
@ -410,4 +427,8 @@ retcode = 0
|
||||||
for t in tasknames:
|
for t in tasknames:
|
||||||
retcode |= run_job(t)
|
retcode |= run_job(t)
|
||||||
|
|
||||||
|
if retcode and (len(tasknames) > 1 or tasknames[0] is not None):
|
||||||
|
tm = localtime()
|
||||||
|
print("SBY {:2d}:{:02d}:{:02d} One or more tasks produced a non-zero return code.".format(tm.tm_hour, tm.tm_min, tm.tm_sec))
|
||||||
|
|
||||||
sys.exit(retcode)
|
sys.exit(retcode)
|
||||||
|
|
Loading…
Reference in a new issue