<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>XJTAG Blog &#187; John Hall</title>
	<atom:link href="http://blog.xjtag.com/author/john/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xjtag.com</link>
	<description>XJTAG boundary scan solutions for the whole product lifecycle</description>
	<lastBuildDate>Mon, 06 Sep 2010 07:00:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Collecting user input from XJEase</title>
		<link>http://blog.xjtag.com/2009/10/collecting-user-input-from-xjease/</link>
		<comments>http://blog.xjtag.com/2009/10/collecting-user-input-from-xjease/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 12:22:06 +0000</pubDate>
		<dc:creator>John Hall</dc:creator>
				<category><![CDATA[XJEase]]></category>

		<guid isPermaLink="false">http://blog.xjtag.com/?p=361</guid>
		<description><![CDATA[A customer recently asked how to read some input from the user in XJEase. The next major release of XJTAG (probably numbered 2.4) will contain a new XJEase function INPUTBOX that makes doing this much simpler. In the meantime, I thought I might outline some code that accomplishes the same thing in the current version.
The [...]]]></description>
			<content:encoded><![CDATA[<p>A customer recently asked how to read some input from the user in XJEase. The next major release of XJTAG (probably numbered 2.4) will contain a new XJEase function <span style="color: #0000ff">INPUTBOX</span> that makes doing this much simpler. In the meantime, I thought I might outline some code that accomplishes the same thing in the current version.</p>
<p><span id="more-361"></span>The core of the code is a loop that simply calls the <span style="color: #0000ff">WAITKEY </span>function to read a character of input at a time, until a carriage return is read. As each character is read it is appended to a string that will be returned and also printed to the screen.</p>
<div style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre><tt><span style="color: #009900">STRING</span> text<span style="color: #990000">;</span>
<span style="color: #009900">INT</span> key<span style="color: #990000">;</span>
<strong><span style="color: #0000ff">DO</span></strong>
    key <span style="color: #990000">:</span><span style="color: #990000">=</span> <strong><span style="color: #0000ff">WAITKEY</span></strong><span style="color: #990000">(</span><span style="color: #990000">)</span><span style="color: #990000">;</span>
<strong><span style="color: #0000ff">WHILE</span></strong> key <span style="color: #990000">:</span><span style="color: #990000">=</span> <strong><span style="color: #0000ff">ASC</span></strong><span style="color: #990000">(</span><span style="color: #ff0000">"\n"</span><span style="color: #990000">)</span> <span style="color: #990000">&amp;</span><span style="color: #990000">&amp;</span> key <span style="color: #990000">!</span><span style="color: #990000">=</span> <strong><span style="color: #0000ff">ASC</span></strong><span style="color: #990000">(</span><span style="color: #ff0000">"\r"</span><span style="color: #990000">)</span><span style="color: #990000">;</span>
    <em><span style="color: #9a1900">//</span></em><em><span style="color: #9a1900"> ignore any control characters (ASCII value less than 0x20)</span></em>
    <strong><span style="color: #0000ff">IF</span></strong> key <span style="color: #990000">&gt;</span><span style="color: #990000">=</span> <span style="color: #993399">0x20</span> <strong><span style="color: #0000ff">THEN</span></strong>
        <strong><span style="color: #0000ff">PRINT</span></strong><span style="color: #990000">(</span><strong><span style="color: #0000ff">CHAR</span></strong><span style="color: #990000">(</span>key<span style="color: #990000">)</span><span style="color: #990000">)</span><span style="color: #990000">;</span>
        text <span style="color: #990000">:</span><span style="color: #990000">=</span> text <span style="color: #990000">+</span> <strong><span style="color: #0000ff">CHAR</span></strong><span style="color: #990000">(</span>key<span style="color: #990000">)</span><span style="color: #990000">;</span>
    <strong><span style="color: #0000ff">END</span></strong><span style="color: #990000">;</span>
<strong><span style="color: #0000ff">END</span></strong><span style="color: #990000">;</span></tt></pre>
</pre>
</div>
<p>This works reasonably well until the user makes a mistake and wants to backspace. Handling backspace requires us to print the backspace character and remove the last character from the string that we&#8217;re building. We can also check the current length of the input string and not allow the user to backspace beyond its start.</p>
<div style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; cursor: text;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;">
<pre><tt><strong><span style="color: #000000;">INPUTBOX(STRING prompt, STRING title, STRING default)(STRING input)</span></strong>
    <span style="color: #009900;">STRING</span> text <span style="color: #990000;">:</span><span style="color: #990000;">=</span> default<span style="color: #990000;">;</span>
    <span style="color: #009900;">INT</span> key<span style="color: #990000;">;</span>
    <span style="color: #009900;">INT</span> width<span style="color: #990000;">;</span>

    <strong><span style="color: #0000ff;">ALERT</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>

    <strong><span style="color: #0000ff;">IF</span></strong> title <span style="color: #990000;">!</span><span style="color: #990000;">=</span> <span style="color: #ff0000;">""</span> <strong><span style="color: #0000ff;">THEN</span></strong>
        <strong><span style="color: #0000ff;">PRINT</span></strong><span style="color: #990000;">(</span>title<span style="color: #990000;">,</span> <span style="color: #ff0000;">"\n"</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
    <strong><span style="color: #0000ff;">END</span></strong><span style="color: #990000;">;</span>
    <strong><span style="color: #0000ff;">PRINT</span></strong><span style="color: #990000;">(</span>prompt<span style="color: #990000;">)</span><span style="color: #990000;">;</span>

    <strong><span style="color: #0000ff;">DO</span></strong>
        key <span style="color: #990000;">:</span><span style="color: #990000;">=</span> <strong><span style="color: #0000ff;">WAITKEY</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
    <strong><span style="color: #0000ff;">WHILE</span></strong> key <span style="color: #990000;">:</span><span style="color: #990000;">=</span> <strong><span style="color: #0000ff;">ASC</span></strong><span style="color: #990000;">(</span><span style="color: #ff0000;">"\n"</span><span style="color: #990000;">)</span> <span style="color: #990000;">&amp;</span><span style="color: #990000;">&amp;</span> key <span style="color: #990000;">!</span><span style="color: #990000;">=</span> <strong><span style="color: #0000ff;">ASC</span></strong><span style="color: #990000;">(</span><span style="color: #ff0000;">"\r"</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
        <strong><span style="color: #0000ff;">IF</span></strong> key <span style="color: #990000;">=</span> <strong><span style="color: #0000ff;">ASC</span></strong><span style="color: #990000;">(</span><span style="color: #ff0000;">"\b"</span><span style="color: #990000;">)</span> <strong><span style="color: #0000ff;">THEN</span></strong>
            width <span style="color: #990000;">:</span><span style="color: #990000;">=</span> <strong><span style="color: #0000ff;">WIDTHOF</span></strong><span style="color: #990000;">(</span>text<span style="color: #990000;">)</span><span style="color: #990000;">;</span>
            <strong><span style="color: #0000ff;">IF</span></strong> width <span style="color: #990000;">&gt;</span> <span style="color: #993399;">0</span> <strong><span style="color: #0000ff;">THEN</span></strong>
                <strong><span style="color: #0000ff;">PRINT</span></strong><span style="color: #990000;">(</span><span style="color: #ff0000;">"\b"</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
                <strong><span style="color: #0000ff;">IF</span></strong> width <span style="color: #990000;">=</span> <span style="color: #993399;">1</span> <strong><span style="color: #0000ff;">THEN</span></strong>
                    text <span style="color: #990000;">:</span><span style="color: #990000;">=</span> <span style="color: #ff0000;">""</span><span style="color: #990000;">;</span>
                <strong><span style="color: #0000ff;">ELSE</span></strong>
                    text <span style="color: #990000;">:</span><span style="color: #990000;">=</span> text<span style="color: #990000;">[</span>width<span style="color: #990000;">-</span><span style="color: #993399;">2</span><span style="color: #990000;">.</span><span style="color: #990000;">.</span><span style="color: #993399;">0</span><span style="color: #990000;">]</span><span style="color: #990000;">;</span>
                <strong><span style="color: #0000ff;">END</span></strong><span style="color: #990000;">;</span>
            <strong><span style="color: #0000ff;">END</span></strong><span style="color: #990000;">;</span>
        <strong><span style="color: #0000ff;">ELSIF</span></strong> key <span style="color: #990000;">&gt;</span><span style="color: #990000;">=</span> <span style="color: #993399;">0x20</span> <strong><span style="color: #0000ff;">THEN</span></strong>
            <em><span style="color: #9a1900;">//</span></em><em><span style="color: #9a1900;"> ignore any control characters (ASCII value less than 0x20)</span></em>
            <strong><span style="color: #0000ff;">PRINT</span></strong><span style="color: #990000;">(</span><strong><span style="color: #0000ff;">CHAR</span></strong><span style="color: #990000;">(</span>key<span style="color: #990000;">)</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
            text <span style="color: #990000;">:</span><span style="color: #990000;">=</span> text <span style="color: #990000;">+</span> <strong><span style="color: #0000ff;">CHAR</span></strong><span style="color: #990000;">(</span>key<span style="color: #990000;">)</span><span style="color: #990000;">;</span>
        <strong><span style="color: #0000ff;">END</span></strong><span style="color: #990000;">;</span>
    <strong><span style="color: #0000ff;">END</span></strong><span style="color: #990000;">;</span>

    <strong><span style="color: #0000ff;">PRINT</span></strong><span style="color: #990000;">(</span><span style="color: #ff0000;">"\n"</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
    input <span style="color: #990000;">:</span><span style="color: #990000;">=</span> text<span style="color: #990000;">;</span>
<strong><span style="color: #0000ff;">END</span></strong><span style="color: #990000;">;</span>

<strong><span style="color: #000000;">GetInput()()</span></strong>
    <span style="color: #009900;">STRING</span> input<span style="color: #990000;">;</span>
    input <span style="color: #990000;">:</span><span style="color: #990000;">=</span> INPUTBOX<span style="color: #990000;">(</span><span style="color: #ff0000;">"Please enter some input and press Enter:"</span><span style="color: #990000;">,</span> <span style="color: #ff0000;">"Input"</span><span style="color: #990000;">,</span> <span style="color: #ff0000;">""</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
    <strong><span style="color: #0000ff;">PRINT</span></strong><span style="color: #990000;">(</span><span style="color: #ff0000;">"\nGot \""</span><span style="color: #990000;">,</span> input<span style="color: #990000;">,</span> <span style="color: #ff0000;">"\"\n"</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
<strong><span style="color: #0000ff;">END</span></strong><span style="color: #990000;">;</span></tt></pre>
</pre>
</div>
<p>The full function appears below, plus an example of its use. It is named INPUTBOX and has the same signature as the upcoming XJEase built-in function, which means once the new version of XJTAG arrives, this function can be deleted and the code will then continue to work. The 3 arguments are the prompt to display, a title and a string that is presented as the default (can be left as an empty string). Note that the example below simply prints the title out, whereas the real INPUTBOX will create a proper dialog box.Note also the use of the <span style="color: #0000ff">ALERT </span>function. If you have more than one XJLink attached in XJRunner, then the output from each is displayed in its own tab; the <span style="color: #0000ff">ALERT </span>function causes the application to draw attention to any tab that requires attention. In XJDeveloper or in XJRunner with just one XJLink attached, then the function has no effect.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xjtag.com/2009/10/collecting-user-input-from-xjease/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netlist Formats</title>
		<link>http://blog.xjtag.com/2009/08/netlist-formats/</link>
		<comments>http://blog.xjtag.com/2009/08/netlist-formats/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 07:00:40 +0000</pubDate>
		<dc:creator>John Hall</dc:creator>
				<category><![CDATA[XJDeveloper]]></category>
		<category><![CDATA[Netlist]]></category>
		<category><![CDATA[Support]]></category>

		<guid isPermaLink="false">http://blog.xjtag.com/?p=82</guid>
		<description><![CDATA[In versions of XJTAG prior to 2.0, the system supported just four netlist formats: RINF, EDIF 2, PADS PCB and Protel. The parsers for these netlists were written carefully against specifications for the formats where possible, and so should reliably parse all valid netlists in those formats.
Frequently during that time, customers would not have a [...]]]></description>
			<content:encoded><![CDATA[<p>In versions of XJTAG prior to 2.0, the system supported just four netlist formats: RINF, EDIF 2, PADS PCB and Protel. The parsers for these netlists were written carefully against specifications for the formats where possible, and so should reliably parse all valid netlists in those formats.</p>
<p><span id="more-82"></span>Frequently during that time, customers would not have a netlist available in any of those formats, and so we began writing simple conversion scripts in Perl for the netlists that customers did have, to convert the simpler ones we found into RINF. With version 2.0, these scripts were formalised and integrated into XJDeveloper, which meant that such netlists were effectively officially supported. Over time, the number of supported formats has grown to nearly 60.</p>
<p>However, these netlist parsers are almost never based on a formal specification, but on the syntax we can infer from the customer&#8217;s example netlist. Often the customer is detached from the CAD process &#8211; they&#8217;re a manufacturer for example &#8211; and so they may not know what application the format is from, which means we may not even have a reliable name for the format! XJDeveloper is now smart enough that the user does not need to specify the netlist format &#8211; the format is recognised and imported automatically. If the format is not one of the original four well-supported formats or one of a handful of others &#8211; because of the uncertainty of naming the format &#8211; XJDeveloper will typically just display the name of the format as &#8220;ASCII&#8221;.</p>
<p>We are proud of the range of formats that the system is capable of parsing &#8211; our aim is that the user simply provides the netlist in whatever format they have and the system accepts it. If you have a netlist that is not recognised, then please contact <a href="mailto:support@xjtag.com">XJTAG Support</a>, and we will be happy to take a look and hopefully add that format to a future release.</p>
<p>If you have a netlist that is recognised, but comes back with errors, then again please <a href="mailto:support@xjtag.com">contact us</a> and we will do our best to fix it &#8211; we are always keen to improve our products.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xjtag.com/2009/08/netlist-formats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
