Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!gatech!bbn!gateway!cadillac.cad.mcc.COM!grout
From: grout@cadillac.cad.mcc.COM (Steve Grout)
Newsgroups: comp.emacs
Subject: GNUEMACS kbd macro aids for translating 7.2 VHDL to 1076 VHDL
Message-ID: <8807132250.AA13710@sunspot>
Date: 13 Jul 88 22:50:51 GMT
Sender: news@bbn.COM
Organization: BBN news/mail gateway
Lines: 466

;;; -*- mode: emacs-lisp -*-
;;; ************************************************************************
;;;  Copyright (C) 1988 Microelectronics and Computer Technology Corporation
;;;  - VLSI CAD Program - %Y%
;;; ************************************************************************
;;;  File Contents:  Aids For Translating 7.2 VHDL to IEEE 1076-1987 VHDL
;;;  This file may be redistributed provided the above copyright notice 
;;;  appears on all copies and that the further free redistribution of this 
;;;  file is not in any way restricted by those who redistribute it.
;;;
;;;  These gnuemacs aids are distributed 'as is', without warranties of any kind.
;;;
;;;  This file is not part of any MCC proprietary or DoD VHDL software.
;;; 
;;;     Author:     Steve Grout
;;;
;;; **********************************************************************
;;; DESCRIPTION: Save the contents of this message as "translate-72-to-1076.el"
;;; 
;;; This file describes the generic changes that will be made
;;; using GNU-EMACS keyboard macro command definitions
;;; to convert ../VHD/CH*/*.vhd 7.2 files to ../VHD/CH*/*.vhdl 1076 files.
;;; Each section briefly describes what the 7.2 language construct WAS
;;;   and what it should be in order to be proper 1076 VHDL.
;;; Each 'fset' expression was created as keyboard macro, named,
;;;    inserted into this file, and bound to an available key.
;;; The 'BINDING - ACTION' table below summarizes the bindings
;;;    and under the conditions this file is used by the author
;;;    shows up as a 'reminder' buffer at the top of the screen.
;;;
;;; Most of the actual translation commands work in the current
;;;   buffer window and are therefore independent of the current
;;;   gnuemacs screen/windowing configuration. 
;;;
;;; However a few commands (e.g., meta-c-shift-B, meta-c-shift-N) presume
;;;   that the current gnuemacs window is about 120-chars by
;;;   55-lines in size, a *shell* buffer has been started, this
;;;   file has both been loaded and is in a buffer, the chapter
;;;   of interest (e.g., ../VHD/CH10/*) is in a dired buffer with
;;;   the point at the file being edited, and the file of interest
;;;   is a buffer, the shell window is cd'd to the chapter of interest,
;;;   and that the command to VHDL analyze a file is 'va'.  Also
;;;   the shell assumes a UNIX 'csh'.
;;;
;;;   This somewhat complicated setup allows for very
;;;   fast editing, verification, and moving on to the next file.
;;;
;;;   If all of that is too much to follow, then just ignore that
;;;   part. (All of this is quite easy to CREATE but much more
;;;   complicated to change...most of the time, a new keyboard was
;;;   simply created to do the most correct action and took the
;;;   place of the previous definition.)
;;;   --jsgrout 5/5/88
;;;  
;;;     Modification History
;;;   --------------------------------------------------------------------
;;; Cleaned up, added copyright boiler-plate, description, and posted
;;;   to vhdl-sw@simtel20.arpa, info-vlsi@think.com, and comp.lis --jsgrout 7/14/88
;;; **********************************************************************
;;;
;;; --------------------------------------------------------------
;;;   BINDING:         ACTION:
;;; --------------------------------------------------------------
;;;
;;;  meta-c-W        Fix with-package     
;;;  meta-shift-B    Fix with-package and add package body
;;;  meta-shift-P    Change package to package body
;;;  meta-c-P        Fix entity ports
;;;  meta-c-A        Fix architectural block
;;;  meta-c-F        Fix for-loop
;;;  meta-c-shift-C  Fix component declarations/instantiations
;;:  meta-c-shift-Q  fix standalone function
;;;  meta-K          Fix package containing a function
;;;  meta-G          fix-qualified-name - '(''..)
;;;  meta-S          Fix signal target list
;;;  meta-A          Fix attribute specification
;;;  c-X c-T         Fix attribute declaration
;;;  meta-c-shift-Y  create a mail message from current shell buffer
;;;  meta-c-shift-D  Move current test to ../VHD/Dead directory.
;;;  meta-c-shift-N  Save, rename, and edit next file
;;;  meta-c-shift-B  test file referenced by vhdl buffer, assuming
;;;                        standard translate window setup.
;;;  meta-o h        Update DoD header for 1076 update, sccs
;;;  meta-shft-;     Comment out line
;;;  meta-;          Uncomment out line
;;;
;;; ------------------------------------------------------------
;
;;; ; make sure cant exit X-emacs unless I want to.
;;;    If I type c-X C-X the worst I do is save buffers...
(global-set-key "" 'save-some-buffers)
 
;;; ------------------------------------------------------------
;1. Convert 'with package, ..use package' statements:
;   WAS:
;     with package  ;
;      use ;
;   IS:
;     -- with package  ;
;     use .all ;
;   FUNCTION: fix-with-package
;   BINDING:  meta-c-W
(fset 'fix-with-package
   "with-- use ;.alluse ")
(global-set-key "" 'fix-with-package) ;  meta-c-W

;;; ------------------------------------------------------------
;2. Convert Entity Port & Generic Statements:
;   WAS:
;     entity  (  ) is
;        generic (  )
;   IS:
;     entity  is
;       generic ( < generic decls> ) ;
;       port (  ) ;
;   FUNCTION: fix-entity-ports
;   BINDING:  meta-c-P
;
(fset 'fix-entity-ports
   "entity()    port  ;generic
(global-set-key "" 'fix-entity-ports)  ;  meta-c-P

;;; ------------------------------------------------------------
;3. Convert Architectural bodies:
;   WAS:
;     architecture  of  is
;       :    block
;         begin
;         ...
;      end block ;
;     end  ;
;   IS:
;     architecture  of  is
;       --  :   block
;           begin
;            ...
;       -- end block ;
;     end ;
;   FUNCTION: fix-arch-block
;   BINDING:  meta-c-A
;
(fset 'fix-arch-block
   "architectureffb
(global-set-key "" 'fix-arch-block) ; meta-c-A

;;; ------------------------------------------------------------
;   WAS:
;      for  :=  loop .. end loop ;
;   IS:
;      for  in  loop .. end loop ;
;   FUNCTION: fix-for-loop
;   BINDING:  meta-c-F
(fset 'fix-for-loop
   "for:=
(global-set-key "" 'fix-for-loop)  ; meta-c-F

;;; ------------------------------------------------------------
; 5. Comment out line VHDL-style
;   WAS:
;     
;      
;   IS:
;     -- 
;     -- 
;      --  
;   IS:
;     
;      
;   FUNCTION: vhdl-uncomment-line
;   BINDING:  meta-;
(fset 'vhdl-uncomment-line
   "--")
(global-set-key ";" 'vhdl-uncomment-line) ; meta-;

;;; ------------------------------------------------------------
;1. Convert  package statements to package-body statements:
;   WAS:
;     with package ;
;     use ;
;     package  ;
;     
;     end  ;
;   IS:
;     -- with package ;
;     use .all ;
;     package body  ;
;     
;     end  ;
;   FUNCTION: fix-with-package-body
;   BINDING:  meta-shift-B
(fset 'fix-with-package-body
   "with-- usebf
(global-set-key "B" 'fix-with-package-body) ;  meta-shift-B

;;; ------------------------------------------------------------
;   WAS:
;     (not applicable)
;   IS:
;
;   FUNCTION: after editing is complete, save the current buffer,
;              kill the buffer, go back to the chapter buffer,
;              rename the file to .vhdl, and begin editing the next file.
;   BINDING:  meta-c-shift-N
(fset 'save-and-get-next-file
   "k3o
(global-set-key "" 'save-and-get-next-file); meta-c-shift-N

;;; ------------------------------------------------------------
;   WAS:
;     package  is
;      
;     end  ;
;   IS:
;     use .all ;
;     package body  is
;      
;     end  ;
;   FUNCTION: Change from package declaration to package body
;   BINDING:  meta-shift-P
(fset 'change-to-package-body
   "packagebody 
(global-set-key "P" 'change-to-package-body); meta-shift-P

;;; ------------------------------------------------------------
;   WAS:
;     package  is
;       ;
;     end  ;
;   IS:
;     use .all ;
;     package  is
;        ;
;     end  ;
;     use .all ;
;     package body  is
;        ;
;     end  ;
;   FUNCTION: fix package containing a function.
;   BINDING:  meta-shift-P
(fset 'fix-package-function
   "package
(global-set-key "k" 'fix-package-function)

;;; ------------------------------------------------------------
;   FUNCTION: Save and run thru VHDL analyzer in next window.
;   BINDING:  meta-c-shift-B
(fset 'test-vhdl-buffer
   "3o
(global-set-key "" 'test-vhdl-buffer); meta-c-shift-B

;;; ------------------------------------------------------------
;   WAS:
;     Architecture  of  is
;       ...
;       component  port (  ) ;
;     begin
;