From 445782ffd34ed8dc35fc12319d5eb0aff1db535e Mon Sep 17 00:00:00 2001 From: Neel Date: Tue, 13 Mar 2018 18:13:35 +0530 Subject: [PATCH] renaming params.py to parse.py. Adding checks on input See #3. Added check to see if muxed lists and dedicated lists do not have any duplciates. This can simulated by replacing uart1_tx to uart2_tx in pinmap.txt. --- src/actual_pinmux.py | 2 +- src/interface_decl.py | 2 -- src/interface_def.py | 1 - src/{params.py => parse.py} | 16 ++++++++++++---- src/pinmux_generator.py | 2 +- src/wire_def.py | 1 - 6 files changed, 14 insertions(+), 10 deletions(-) rename src/{params.py => parse.py} (59%) diff --git a/src/actual_pinmux.py b/src/actual_pinmux.py index 37c8cdf..02603a9 100644 --- a/src/actual_pinmux.py +++ b/src/actual_pinmux.py @@ -1,4 +1,4 @@ -from params import * +from parse import * from string import digits diff --git a/src/interface_decl.py b/src/interface_decl.py index 145eeaf..826614d 100644 --- a/src/interface_decl.py +++ b/src/interface_decl.py @@ -1,5 +1,3 @@ -from params import * - # ========= Interface declarations ================ # mux_interface = ''' method Action cell{0}_mux(Bit#({1}) in);''' diff --git a/src/interface_def.py b/src/interface_def.py index 12fa6c9..209cb7a 100644 --- a/src/interface_def.py +++ b/src/interface_def.py @@ -1,4 +1,3 @@ -from params import * # === templates for interface definitions ====== # mux_interface_def = ''' method Action cell{0}_mux (Bit#({1}) in ); diff --git a/src/params.py b/src/parse.py similarity index 59% rename from src/params.py rename to src/parse.py index d191697..db7a48a 100644 --- a/src/params.py +++ b/src/parse.py @@ -20,11 +20,19 @@ for lineno, line in enumerate(pinmapfile): muxed_cells.append(line1) # ============================================= # -# check if the user has not screwed up by ensuring that no pin is -# present in both muxed and dedicated pins -# TODO +# ======= Multiple checks to see if the user has not screwed ======# -# =========================================== # +# Check-1: ensure that no pin is present in both muxed and dedicated pins +for muxcell in muxed_cells: + for dedcel in dedicated_cells: + if(dedcel[1] in muxcell): + print("ERROR: " + str(dedcel[1]) + " present \ + in dedicated & muxed lists") + exit(1) +# Check-2: confirm if N_* matches the instances in the pinmap +# ============================================================== # + +# == user info after parsin ================= # N_IO = len(dedicated_cells) + len(muxed_cells) print("Max number of IO: " + str(N_IO)) print("Muxed IOs: " + str(len(muxed_cells))) diff --git a/src/pinmux_generator.py b/src/pinmux_generator.py index 06c45ac..8b25d9e 100644 --- a/src/pinmux_generator.py +++ b/src/pinmux_generator.py @@ -24,7 +24,7 @@ import math # project module imports from interface_decl import * from interface_def import * -from params import * +from parse import * from wire_def import * from actual_pinmux import * diff --git a/src/wire_def.py b/src/wire_def.py index 0cd9cb2..da5fbef 100644 --- a/src/wire_def.py +++ b/src/wire_def.py @@ -1,4 +1,3 @@ -from params import * # == Intermediate wire definitions ==# muxwire = ''' Wire#(Bit#({1})) wrmux{0} <-mkDWire(0);''' -- 2.30.2