Skip to content

Commit

Permalink
Merge pull request #6 from 1138-4EB/add-context
Browse files Browse the repository at this point in the history
Added VHDL context for library JSON.
  • Loading branch information
Paebbels committed May 23, 2018
2 parents 8a33745 + 59d849d commit b2bbeeb
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services: docker
language: minimal
install: skip
script: ./VUnit/run.sh
addons:
apt:
packages:
- docker-ce
5 changes: 2 additions & 3 deletions Examples/Boards_VUnit.vhdl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
library vunit_lib;
context vunit_lib.vunit_context;

use work.json.T_JSON;
use work.json.jsonLoad;
use work.json.jsonGetString;
library JSON;
context JSON.json_ctx;

entity tb_boards is
generic (
Expand Down
5 changes: 3 additions & 2 deletions VUnit/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

vu = VUnit.from_argv()

lib = vu.add_library("JSON")
lib.add_source_files(join(root, "..", "vhdl", "*.vhdl"))
lib = vu.add_library("lib")
lib.add_source_files(join(root, "../vhdl/JSON.pkg.vhdl"))
lib.add_source_files(join(root, "../Examples/Boards_VUnit.vhdl"))
lib.add_source_files(join(root, "..", "Examples", "Boards_VUnit.vhdl"))

vu.set_generic('tb_cfg_file', '../Data/Boards2.json')

Expand Down
2 changes: 1 addition & 1 deletion VUnit/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
cd $(dirname $0)

$(command -v winpty) docker run --rm -it \
-v /$(realpath $(pwd)/..)://work \
-v /$(cd $(pwd)/.. && pwd)://work \
-w //work \
ghdl/ext:vunit-master bash -c "cd ./VUnit && VUNIT_SIMULATOR=ghdl python3 run.py -v"
52 changes: 52 additions & 0 deletions vhdl/JSON.ctx.vhdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
-- vim: tabstop=2:shiftwidth=2:noexpandtab
-- kate: tab-width 2; replace-tabs off; indent-width 2;
--
-- =============================================================================
-- _ ____ ___ _ _ __ __ ___ _ ____ _
-- | / ___| / _ \| \ | | / _| ___ _ __ \ \ / / | | | _ \| |
-- _ | \___ \| | | | \| |_____| |_ / _ \| '__|___\ \ / /| |_| | | | | |
-- | |_| |___) | |_| | |\ |_____| _| (_) | | |_____\ V / | _ | |_| | |___
-- \___/|____/ \___/|_| \_| |_| \___/|_| \_/ |_| |_|____/|_____|
--
-- =============================================================================
-- Authors: 1138-4EB [GitHub User]
--
-- Package: JSON context and public API
--
-- Description:
-- ------------------------------------
-- For detailed documentation see below.
--
-- License:
-- ============================================================================
-- Copyright 2007-2018 Patrick Lehmann - Dresden, Germany
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- ============================================================================

context json_ctx is
library JSON;
use JSON.json.T_JSON;
use JSON.json.jsonLoad;
use JSON.json.jsonNoParserError;
use JSON.json.jsonGetErrorMessage;
use JSON.json.jsonGetContent;
use JSON.json.jsonGetString;
use JSON.json.jsonGetBoolean;
use JSON.json.jsonIsBoolean;
use JSON.json.jsonIsNull;
use JSON.json.jsonIsString;
use JSON.json.jsonIsNumber;
-- use JSON.json.jsonGetIntArray;
end context;

0 comments on commit b2bbeeb

Please sign in to comment.