Skip to content

Commit

Permalink
Now log to sys.stdout instead of sys.stderr (#22)
Browse files Browse the repository at this point in the history
* Now logging goes to sys.stdout

* Now have a consistent cleanall target

* Now 2.1a

Co-authored-by: Ray Salemi <ray_salemi@mentor.com>
  • Loading branch information
raysalemi and Ray Salemi committed Nov 7, 2021
1 parent f507c4e commit b1ad4b3
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 36 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab
8 changes: 8 additions & 0 deletions cleanall.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
@rm -rf log.txt
@rm -rf sim_build
@rm -rf modelsim.ini
@rm -rf transcript

6 changes: 2 additions & 4 deletions examples/TinyALU/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ SIM ?= icarus
VERILOG_SOURCES =$(CWD)/hdl/verilog/tinyalu.sv
MODULE := tinyalu_cocotb
TOPLEVEL := tinyalu
TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm results.xml
include ../../cleanall.mk
6 changes: 3 additions & 3 deletions pyuvm/s06_reporting_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

from pyuvm.s05_base_classes import uvm_object
import logging
import sys
from cocotb.log import SimColourLogFormatter, SimTimeContextFilter
from logging import DEBUG, CRITICAL, ERROR, \
WARNING, INFO, NOTSET, NullHandler # noqa: F401
from logging import DEBUG, CRITICAL, ERROR, WARNING, INFO, NOTSET, NullHandler # noqa: F401, E501


class PyuvmFormatter(SimColourLogFormatter):
Expand Down Expand Up @@ -38,7 +38,7 @@ def __init__(self, name):
self.logger.setLevel(level=logging.INFO) # Default is to print INFO
# We are not sending log messages up the hierarchy
self.logger.propagate = False
self._streaming_handler = logging.StreamHandler()
self._streaming_handler = logging.StreamHandler(sys.stdout)
self._streaming_handler.addFilter(SimTimeContextFilter())
# Don't let the handler interfere with logger level
self._streaming_handler.setLevel(logging.NOTSET)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pyuvm",
version="2.1",
version="2.1a",
author="Ray Salemi",
author_email="ray@raysalemi.com",
description="A Python implementation of the UVM using cocotb",
Expand Down
5 changes: 1 addition & 4 deletions tests/cocotb_tests/config_db/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
include ../../../cleanall.mk
5 changes: 1 addition & 4 deletions tests/cocotb_tests/queue/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
include ../../../cleanall.mk
5 changes: 1 addition & 4 deletions tests/cocotb_tests/run_phase/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
include ../../../cleanall.mk
5 changes: 1 addition & 4 deletions tests/cocotb_tests/t08_factories/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
include ../../../cleanall.mk
5 changes: 1 addition & 4 deletions tests/cocotb_tests/t09_phasing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
include ../../../cleanall.mk
5 changes: 1 addition & 4 deletions tests/cocotb_tests/t12_tlm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
include ../../../cleanall.mk
5 changes: 1 addition & 4 deletions tests/cocotb_tests/t13_components/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ TOPLEVEL_LANG=verilog
COCOTB_HDL_TIMEUNIT=1us
COCOTB_HDL_TIMEPRECISION=1us
include $(shell cocotb-config --makefiles)/Makefile.sim

cleanall: clean
@rm -rf __pycache__
@rm -rf results.xml
include ../../../cleanall.mk

0 comments on commit b1ad4b3

Please sign in to comment.