-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
10,618 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
############################################################################### | ||
# Copyright (c) 2013 Potential Ventures Ltd | ||
# Copyright (c) 2013 SolarFlare Communications Inc | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of Potential Ventures Ltd, | ||
# SolarFlare Communications Inc nor the | ||
# names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY | ||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
############################################################################### | ||
|
||
.PHONY: all | ||
all: test | ||
|
||
.PHONY: clean | ||
clean: | ||
-@find . -name "obj" | xargs rm -rf | ||
-@find . -name "*.pyc" | xargs rm -rf | ||
-@find . -name "*results.xml" | xargs rm -rf | ||
$(MAKE) -C examples clean | ||
$(MAKE) -C tests clean | ||
|
||
.PHONY: do_tests | ||
do_tests:: | ||
$(MAKE) -k -C tests | ||
do_tests:: | ||
$(MAKE) -k -C examples | ||
|
||
# For Jenkins we use the exit code to detect compile errors or catastrophic | ||
# failures and the XML to track test results | ||
.PHONY: jenkins | ||
jenkins: do_tests | ||
./bin/combine_results.py --suppress_rc --testsuites_name=cocotb_regression | ||
|
||
# By default want the exit code to indicate the test results | ||
.PHONY: test | ||
test: | ||
$(MAKE) do_tests; ret=$$?; ./bin/combine_results.py && exit $$ret | ||
|
||
COCOTB_MAKEFILES_DIR = $(realpath $(shell cocotb-config --makefiles)) | ||
AVAILABLE_SIMULATORS = $(patsubst .%,%,$(suffix $(wildcard $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.*))) | ||
|
||
.PHONY: help | ||
help: | ||
@echo "" | ||
@echo "This cocotb makefile has the following targets" | ||
@echo "" | ||
@echo "all, test - run regression producing combined_results.xml" | ||
@echo " (return error code produced by sub-makes)" | ||
@echo "jenkins - run regression producing combined_results.xml" | ||
@echo " (return error code 1 if any failure was found)" | ||
@echo "clean - remove build directory and all simulation artefacts" | ||
@echo "" | ||
@echo "The default simulator is Icarus Verilog." | ||
@echo "To use another, set the environment variable SIM as below." | ||
@echo "Available simulators:" | ||
@for X in $(sort $(AVAILABLE_SIMULATORS)); do \ | ||
echo export SIM=$$X; \ | ||
done | ||
@echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Simple script to combine JUnit test results into a single XML file. | ||
Useful for Jenkins. | ||
""" | ||
|
||
import os | ||
import sys | ||
import argparse | ||
from xml.etree import ElementTree as ET | ||
|
||
|
||
def find_all(name, path): | ||
for root, dirs, files in os.walk(path): | ||
if name in files: | ||
yield os.path.join(root, name) | ||
|
||
def get_parser(): | ||
"""Return the cmdline parser""" | ||
parser = argparse.ArgumentParser(description=__doc__, | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
|
||
parser.add_argument("--directory", dest="directory", type=str, required=False, | ||
default=".", | ||
help="Name of base directory to search from") | ||
|
||
parser.add_argument("--output_file", dest="output_file", type=str, required=False, | ||
default="combined_results.xml", | ||
help="Name of output file") | ||
parser.add_argument("--testsuites_name", dest="testsuites_name", type=str, required=False, | ||
default="results", | ||
help="Name value for testsuites tag") | ||
parser.add_argument("--verbose", dest="debug", action='store_const', required=False, | ||
const=True, default=False, | ||
help="Verbose/debug output") | ||
parser.add_argument("--suppress_rc", dest="set_rc", action='store_const', required=False, | ||
const=False, default=True, | ||
help="Suppress return code if failures found") | ||
|
||
return parser | ||
|
||
|
||
def main(): | ||
|
||
parser = get_parser() | ||
args = parser.parse_args() | ||
rc = 0 | ||
|
||
result = ET.Element("testsuites", name=args.testsuites_name); | ||
|
||
for fname in find_all("results.xml", args.directory): | ||
if args.debug : print("Reading file %s" % fname) | ||
tree = ET.parse(fname) | ||
for ts in tree.iter("testsuite"): | ||
if args.debug: | ||
print("Ts name : %s, package : %s" % ( ts.get('name'), ts.get('package'))) | ||
use_element = None | ||
for existing in result: | ||
if existing.get('name') == ts.get('name') and existing.get('package') == ts.get('package'): | ||
if args.debug: | ||
print("Already found") | ||
use_element = existing | ||
break | ||
if use_element is None: | ||
result.append(ts) | ||
else: | ||
#for tc in ts.getiterator("testcase"): | ||
use_element.extend(list(ts)); | ||
|
||
if args.debug: | ||
ET.dump(result) | ||
|
||
testsuite_count = 0 | ||
testcase_count = 0 | ||
for testsuite in result.iter('testsuite'): | ||
testsuite_count += 1 | ||
for testcase in testsuite.iter('testcase'): | ||
testcase_count += 1 | ||
for failure in testcase.iter('failure'): | ||
if args.set_rc: | ||
rc = 1 | ||
print("Failure in testsuite: '%s' classname: '%s' testcase: '%s' with parameters '%s'" % (testsuite.get('name'), testcase.get('classname'), testcase.get('name'), testsuite.get('package'))) | ||
|
||
print("Ran a total of %d TestSuites and %d TestCases" % (testsuite_count, testcase_count)) | ||
|
||
|
||
ET.ElementTree(result).write(args.output_file, encoding="UTF-8") | ||
return rc | ||
|
||
|
||
if __name__ == "__main__": | ||
rc = main() | ||
sys.exit(rc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
############################################################################### | ||
# Copyright (c) 2013, 2018 Potential Ventures Ltd | ||
# Copyright (c) 2013 SolarFlare Communications Inc | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of Potential Ventures Ltd, | ||
# SolarFlare Communications Inc nor the | ||
# names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY | ||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
############################################################################### | ||
|
||
EXAMPLES := axi_lite_slave/tests \ | ||
endian_swapper/tests \ | ||
|
||
.PHONY: $(EXAMPLES) | ||
|
||
.PHONY: all | ||
all: $(EXAMPLES) | ||
|
||
$(EXAMPLES): | ||
@cd $@ && $(MAKE) | ||
|
||
.PHONY: clean | ||
clean: | ||
$(foreach TEST, $(EXAMPLES), $(MAKE) -C $(TEST) clean;) | ||
|
||
regression: | ||
$(foreach TEST, $(EXAMPLES), $(MAKE) -C $(TEST) regression;) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# AXI Lite Demo | ||
|
||
Description: In order to simplify AXI Lite Transactions we use an module that | ||
translates AXI Lite Slave transactions to a simple register read/write. | ||
|
||
There are other projects that translate AXI Slave signals to Wishbone. | ||
|
||
|
||
## Source Files | ||
|
||
* ``tb_axi_lite_slave``: Testbench interface, primarily used to translate | ||
the cocotb AXI Lite bus signals to the signals within ``axi_lite_demo`` core. | ||
|
||
* ``axi_lite_demo``: demonstration module, anyone who wishes to interact | ||
with an AXI Lite slave core can use this as a template. | ||
|
||
* ``axi_lite_slave``: Performs all the low level AXI Translactions. | ||
* Addresses and data sent from the master are decoded from the AXI Bus and | ||
sent to the user with a simple ``ready``, ``acknowledge`` handshake. | ||
* Address and data are read from the slave using a simple | ||
``request``, ``ready`` handshake. | ||
|
||
## NOTE: Test ID | ||
|
||
If you use a logic analyzer wave viewer it's hard to determine which test is | ||
currently running so there is a value called ``test_id`` in the test bench | ||
so when viewing the waveforms the individual tests can easily be identified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
`ifndef __AXI_DEFINES__ | ||
`define __AXI_DEFINES__ | ||
|
||
//AXI Defines | ||
|
||
//--Burst | ||
`define AXI_BURST_FIXED 2'b00 | ||
`define AXI_BURST_INCR 2'b01 | ||
`define AXI_BURST_WRAP 2'b10 | ||
|
||
//--Burst Size | ||
`define AXI_BURST_SIZE_8BIT 3'b000 | ||
`define AXI_BURST_SIZE_16BIT 3'b001 | ||
`define AXI_BURST_SIZE_32BIT 3'b010 | ||
`define AXI_BURST_SIZE_64BIT 3'b011 | ||
`define AXI_BURST_SIZE_128BIT 3'b100 | ||
`define AXI_BURST_SIZE_256BIT 3'b101 | ||
`define AXI_BURST_SIZE_512BIT 3'b110 | ||
`define AXI_BURST_SIZE_1024BIT 3'b111 | ||
|
||
//--Response | ||
`define AXI_RESP_OKAY 2'b00 | ||
`define AXI_RESP_EXOKAY 2'b01 | ||
`define AXI_RESP_SLVERR 2'b10 | ||
`define AXI_RESP_DECERR 2'b11 | ||
|
||
//--Lock | ||
`define AXI_LOCK_NORMAL 2'b00 | ||
`define AXI_LOCK_EXCLUSIVE 2'b01 | ||
`define AXI_LOCK_LOCKED 2'b10 | ||
|
||
//--cache | ||
//----Bufferable | ||
`define AXI_CACHE_NON_BUF 1'b0 | ||
`define AXI_CACHE_BUF 1'b1 | ||
//----Cachable | ||
`define AXI_CACHE_NON_CACHE 1'b0 | ||
`define AXI_CACHE_CACHE 1'b1 | ||
//----Read Allocate | ||
`define AXI_CACHE_NON_RA 1'b0 | ||
`define AXI_CACHE_RA 1'b1 | ||
//----Write Allocate | ||
`define AXI_CACHE_NON_WA 1'b0 | ||
`define AXI_CACHE_WA 1'b1 | ||
//----Unused | ||
`define AXI_CACHE_UNUSED 4'b0000 | ||
|
||
//--Protection | ||
//----ARPROT[0] | ||
`define AXI_PROT_NORMAL 1'b0 | ||
`define AXI_PROT_PRIVLEDGE 1'b1 | ||
|
||
//----ARPROT[1] | ||
`define AXI_PROT_SECURE 1'b0 | ||
`define AXI_PROT_NON_SECURE 1'b1 | ||
|
||
//----ARPROT[2] | ||
`define AXI_PROT_DATA 1'b0 | ||
`define AXI_PROT_INST 1'b1 | ||
|
||
//----Unused: | ||
`define AXI_PROT_UNUSED {`AXI_PROT_NORMAL, `AXI_PROT_NON_SECURE, `AXI_PROT_DATA} | ||
|
||
//--Low Power Mode | ||
`define AXI_POWER_LOW 1'b0 | ||
`define AXI_POWER_NORMAL 1'b1 | ||
|
||
`endif //__AXI_DEFINES__ |
Oops, something went wrong.