1 / 10

Something “Simple”

Something “Simple”. Simple …. A simple mistake in some “simple” electronics Traditional application, nothing new. Just one example of a problem that is becoming a common error, not quite epidemic proportions. Yet. Simple Changes …. Simulation now standard, of course Almost a religion

hisoki
Télécharger la présentation

Something “Simple”

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Something “Simple”

  2. Simple … • A simple mistake in some “simple” electronics • Traditional application, nothing new. • Just one example of a problem that is becoming a common error, not quite epidemic proportions. Yet.

  3. Simple Changes … • Simulation now standard, of course • Almost a religion • For our example -- two requirements • Check corner cases (start, end of line, beginning of next line, end) • No off by one errors • 4 megabit detector simulation is lengthy • “Solution:” Comment out or change constants to run on a smaller array to check logic for corner cases and off by one errors.

  4. Comments -- Very Simple • Used to: • Control size and length of simulations • “Try things out” • “Isolate problems when troubleshooting simulations” • The Problem • Commented out “code” does not always get restored • Comments are buried in the “code.” • Been seeing this regularly

  5. Comments -- Some ThoughtsWhen VHDL is in the Comment • Designers: • Write a text description for all comments that contain VHDL • Use a preprocessor for “conditional compilation.” We wrote KPP for this reason. • Use the VHDL generic feature. • Reviewers: • Flag and investigate all comments that contain VHDL

  6. KPP - A VHDL Pre-Processor • A pre-processor, similar to CPP, designed for VHDL applications. • Provides many functions such as: • #def, #undef, #ifdef • #include • define <variable> {number}; #undef <variable> • Loops • other features. • Makes temporary modifications easier to control and see. http://klabs.org/richcontent/software_content/kpp.htm

  7. KPP Example #define variable1 -- define variable1 and make it accessible in the program #define variable2 -- define variable2 and make it accessible in the program #undef variable2 -- undefine variable2 and make it inaccessible in the program #ifdef variable1 Any code written in here should come through because variable1 is defined. #ifndef variable2 Any code written in here should come through because variable2 is not defined. #endif #else This code should not come through. #endif #ifndef variable1 This code should not come through. #else This code should come through. #endif http://klabs.org/richcontent/software_content/kpp.htm

  8. Generics Example: Part 1 Definition: Parameterizable D Flip-flop with Reset, Enable library IEEE; use IEEE.std_logic_1164.all; entity pDFFE is generic (n: integer := 2); port (d: in std_logic_vector(n - 1 downto 0); en: in std_logic; clk: in std_logic; rst: in std_logic q: out std_logic_vector(n - 1 downto 0); ) ; end pDFFE;

  9. Generics Example: Part 2 Instantiation: Parameterizable D Flip-flop with Reset, Enable library IEEE; use IEEE.std_logic_1164.all; use work.primitive.all; architecture parameterize of pararnDFF is ul: pDFFE genericmap(n => size) portmap (d => data, clk =>clock, rst => reset, en => ff_enable, q => reg ); u2: pTRIBUF generic map(n => size) port map (ip => reg,

More Related