Wednesday, July 3, 2013

[Tech] Xilinx ISE, Vivado, and Fedora 19

[technical post warning :]

Once upon a time I took a sequence of classes in which I got a taste of what a class of microchips--FPGAs--could do. I have further seen their use in high-performance professional and research work. In simple terms, these chips allow you to try out microchip designs before spending a few million getting them actually made (with a few obligatory gotchas).

So, when the university I was attending decided to upgrade to Digilent Spartan 3E Starter Boards, I made a point of buying one of their old Digilent Spartan 3 Boards, featuring the Xilinx XC3S200-ft256 (Spartan 3) FPGA.

About a year and a half later, I'm just now getting to trying to play with it. As it turns out, older versions of Ubuntu don't play nice with ISE (a previous post described some of my problems), so I upgraded from Ubuntu 10.04 to Fedora 19 to start working.

Tip 1: Vivado is distinctly not ISE. Vivado is their high-level SoC design tool, while ISE has less power and more control...and easier licensing. ISE WebPack is what they offer for free. Save yourself a 6GB download and don't download Vivado--download ISE. I got ISE 14.5.

Tip 2: Once I got ISE downloaded and installed, I figured out that the cable driver installation and the "Simulate Behavioral Model" function both rely on having GCC handy. In Fedora, I found a good post here showing this one command:

sudo yum groupinstall "Development Tools"

that is somewhat analogous to Debian and Ubuntu's "build-essential" package. This gets the simulator working.

Narrative: From here I went on to writing a small Verilog test that merely wired an input to an output. I also pulled in the UCF for the Spartan 3 Board (that Digilient no longer seems to host), configured it, and got it through the Synthesize - XST, Implement Design, and Generate Programming File phases without a hitch. (Not even a warning...except for an unused signal I forgot to take out.)

The next phase was "Configure Target Device," which pulls up Xilinx' Impact programmer tool...which didn't recognize my cable. Big surprise--it had told me driver installation failed.

Tip 3: use Tip 2 PRIOR to installation. If you didn't (or like micromicromanaging things), simply run (assuming you used the default root installation target):

cd /opt/Xilinx/14.5/ISE_DS/common/bin/lin64/digilent
sudo bash ./install_digilent.sh

answer its questions, and smile. 

Tip 4: I'm not sure what problems it might cause (I was find all the way through launching Impact), but do remember to modify your environment. In my case, I simply added these lines to .bashrc:

# set up environment for Xilinx tools
. /opt/Xilinx/14.5/ISE_DS/settings64.sh
# because I didn't use the default
export DIGILENT_ADEPT_CONF="/usr/local/etc/digilent-adept.conf"

Tip 5: OS Not Supported
Dear Xilinx, >:-P Love, Jon

If you dig around, you will likely find and try

cd /opt/Xilinx/14.5/ISE_DS/common/bin/lin64/install_script/install_drivers
sudo ./install_drivers

which fails miserably because

linux_common.h:29:4: error: #error "This kernel is too recent: not supported by this file"

So, off I traipsed to http://rmdir.de/~michael/xilinx/ where I learned I could run

sudo yum install libusb-devel # or your distro's variant; solves "missing usb.h" problem
git clone git://git.zerfleddert.de/usb-driver
cd usb-driver
make
LD_PRELOAD=/home/username/tmp/usb-driver/usb-driver $STUFF/ise

Now when I launch Impact, I can do a boundary scan and talk to the FPGA.

Next problem was "DONE pin did not go high." 

I tried FPGA Start Clock, High-Z unused devices, power cycling...but the next day it worked. (This was after a full power cycle of my aging P4-era box.) Make sure that Start Clock is set to JTAG, power on the FPGA, THEN connect the programming cable. That fixed it for me, anyways.

Monday, July 1, 2013

Mormons, Evolution, and Science (and perhaps magnets)

"We have the history recorded in the crust of the Earth. We have the history recorded in the scriptures. One day we will have all the facts and the two will blend together." 
--Paraphrase of a paraphrase of a quote whose origin may one day be hunted down

So...if you're wondering what Mormons believe on a given scientific topic, you'll probably find the answer in the best textbooks on the topic.

Sunday, June 23, 2013

Winter

Alder looked out the window at the softly falling snow, appreciating the monochromatic scintillation as the blanket grew deeper.

The newcomer was sitting up in her bed, starting at him hard.

"How do you stay sane? Well this blasted winter ever end? It's so...plain!" Her outburst was vehement, but there was a hint of realization in it.

"You don't understand, your highness. I know winter. I hardly know anything else. It's harshness is only broken by its occasional harsh beauty." Noting the princess' distress, he began pacing in front of the wall of windows that overlooked the snow gardens.

"There is one thing we do know, those of us that live here: We know that winter will end.

"This knowledge--not the belief the city folk accuse us of--keeps us alive. Perhaps, during your stay here, you will see spring. You may even bring it to us."

He stopped, intently studying the promise of spring glimmering in her eyes, fighting to the her icy visage.

Perhaps, one day.

Saturday, June 1, 2013

A Break in the Case

The search had been quite fruitful; nearly every cubic kilometer of the old Luk'naga golem was accounted for. Varying sizes of chunk drifted in a tesselating grid of parking orbits around the cold, methane-bitten surface of Niffleheim, the most neutral of all the space spanned by the Mul'ulanki federation.

Some chunks had been easily repurposed and were now fully functional members of the warship-cum-planetoid. Most, however, still maintained a defensive, preservationist stance, punishing salvage and recovery attempts while refusing to be reprogrammed. This tenacity was most curious to the commander, but the techies insisted that this stubborn nature was in keeping with the original design and would be a great asset were it properly turned to the federation's purposes.

Except that we can't even melt it down without losing men left and right... The commander shifted the can of pencils from one place on his desk to another, and started reading the reports, hoping for some clue that would let them reuse the recovered components.

He didn't notice the pencils start to rattle, but he did notice when the deck lurched about a foot to his right. That felt like a hyperjump, but the magnitude could only imply a full attack fleet or--that--

He stared out his office's full-wall porthole, barely comprehending. A small planetoid was hovering at the lunar L1 point. The markings were right, and the geometry fit what intel the federation had bothered to collect: this was the Nar'ara golem. Something was missing though...no support vessels? Not even a squadron of fighters on patrol? What was going on?

He absently fingered his watch to answer the chirping that had started just as the lurch had. "Sir, you've probably seen it, but we need you down in Control pronto. The golem is hailing us, and I think this one's above our combined pay grades..."



The Interfederation Astrophysical Year was conceived as a method for fostering goodwill among the polities of Cluster 6. It involved a wide range of scientific explorations and experiments that would not only push the limits of current physics, but would provide vast quantities of data that would illuminate ill-explored facets of everyday navigation. Probes into Oort cloud ionization, Phil's Phenomenon (a queer error in hyperjump projections), and numerous other oddities were scheduled, with each federation vowing to share any and all data acquired for the benefit of all. It ended up occupying the better part of a decade.

For reasons yet to be understood, the Nar'ara had only deigned to volunteer their golem to the effort.

It was on an assignment from the Secretary General of the IAY that the golem had shown up to recruit the Luk'naga to perform some experiments regarding the effects of light on gravity. (The effects of gravity on light were already understood, you see.)

Nobody tells us anything, the commander thought crossly. He had just gotten off the comm with the President herself, who authorized the release, complete with nuclear arming codes. Wow. I guess we'll just babysit this wreckage until it gets back...



Now, this is curious. My administrators have not bothered to gather intel about the foreign federation, yet here I am cooperating with its golem. I have a question or two that ought to be cleared up...



The commander stood behind the lead engineer's chair, leaving over to make out the figures on the display.

"It just stopped snapping back, like that?"

"Yes sir. We were only testing reprogramming channel one, which is what this screen shows." The civilian pressed a few keys and the patterns on the screen shifted subtly. "Shown here is channel two," again, another yet less subtle change, "and here is channel one on the first find. Since it hasn't snapped we've successfully repurposed all sixteen channels of the prime evaluator drive. We don't know the status of the Deep Sigma Phi, but at least one channel has not snapped in three other wreckage fragments. We're working as fast as we can to try other modules, and I think we'll be ready when it returns." The techneer was clearly proud of his team's achievements in the past twenty-four hours.

"You've done good work here. Get some rest; I'll be by at 1000 tomorrow to follow up." The commander was pleased as well; his long-sought dream of full recovery of the golem's might and glory for the Mul'ulanki federation was in reach...assuming nothing else went wrong.

Saturday, April 27, 2013

Salvage

When the first piece of wreckage had been brought in, the scientists had started their work immediately.
Visual inspection showed that it contained a large fragment of the AI's core as well as a swath of the surrounding support equipment, probably from the emotive and generative subsystems.
Luckily, the salvage crews had learned from the original recovery: they all wore radiation instrumentation and shielding when they began exploring the new fragment's maintenance shafts. It had saved most of them from the sudden appearance of heavy gamma emitters in one of them. I'm not looking forward to writing the letters to the casualties' families...
After that, the comp techneers had decided to try to use the built-in failsafes to flush the contaminants out. This involved sending one man in, connecting up a few hundred tiny wires with a nanoscope, and then interfacing with the systems from a remote, safe location.
Sadly, the tech didn't quite make it out before another random surge rendered his escape moot, but the job had been done, the uplink installed, and remote exploration begun. Another letter, and another expert lost...
Further discoveries awaited the technologists. The AI core was still looping in a pre-Collapse state, and all of the adaptable logic was configured to use Nar'ara protocols -- hence the defensive radiation floods. Still, section appeared to house some extremely important functions, so the crew started trying to repurpose it -- after cracking the security and reprogramming a few small modules, the whole system would reset to its old config, snap the connection, and then start trying to convert the remote console into a Nar'ara control system.
After avoiding a few catastrophes from internal system reversion, the wreckage was catalogued, tidied up a bit, and moved into a parking orbit near the reassembly site.
After hearing about this, the admiralty quietly sent two more salvage ships with better-trained crews, fresh supplies, and a hand-written note:
"Keep looking."

Sunday, March 31, 2013

SciShow!

I would like to call your attention to one of the most fascinating, well-made, and generally awesome YouTube series I know: SciShow.

These short videos are packed with an extremely wide variety of excellent information, and the personality delivering them paces himself well and enjoys his work. Deadly poisons, lethal diseases, Martian habitability, and many other topics have all made it into his broadcasts. Occasionally his topics might make some blush, but his frank delivery in these cases is refreshing. 

Needless to say, I enjoy his show. 

Sure he's not exactly precisely perfectly right sometimes (according to my microbiologist wife, who loves the show); however, to (rather terribly) paraphrase Zombie Feynman, "[By teaching people to value basic scientific knowledge and application, SciShow] is doing more to drag humanity out of the unscientific darkness than a thousand lessons in rigor."

I am also quite proud of the currency of his videos. He generally comments on research that is very recent while also going back in time to research the history of his topics quite well.

If you haven't watched any, go watch one now. 

No, really. I'm about to make a whiny little point, and the awesomeness of his work ought to be appreciated before reading my comment on one of his videos (NASA Needs You).

Back? Well, here goes:


-- begin misanthropy --

If you are going to venture into the political realm, please do so completely responsibly. Government economics is a fascinating field, with opinions all over the board. I would be happy, I think, to see a shift in our budgetary priorities towards science and away from pork. I am also of the opinion that we can't spend more than we have, so if everything gets cut then science probably should too, though perhaps by a smaller proportion. (According to our dear President, this was actually the case when budgets actually decreased.) "OMG, the NIH will be cut by $1 billion!!!1!" is entirely insufficient in this case, when what appears to be the 2013 budget is $30 billion. One Billion is a scary number, as my wife, several students, and an experienced professor would be going to China to do oncology work this summer on a measly $100,000 (that's its own story), but the sheer scale of the NIH's work shouldn't be so blithely understated.

Oh, and "These budget cuts cannot be reversed"? Really? Sure these budget cuts won't as per their designs, but do you really think the NIH, NIST, NSF, or DoE budget is a monotonic sequence?

-- end misanthropy --


That said, I'm happy to hear that NASA got $200 million more than they asked for this coming year. I would love to hear about the NIH's budget increasing too; PubMed is an awesome resource whose growth I am proud to say my tax dollars support.

Wednesday, March 27, 2013

The Collector's Box

Reconstruction after the war had been difficult, but it had been approached with a renewed rigor among the lassaiz faire policies following the outbreak of peace.

Reconstruction of the ISL's Golem, on the other hand, was not.

Calvin had been working on the project for quite some time, and figured he had seen it all: The Alliance's indifference to the project had left it massively underfunded and, consequently, understaffed. The Golem's AI core was unresponsive to even the most skilled psychotronic engineers. Only about a fifth of the original superstructure of the Golem had been recovered, and they only had enough resources to run one dilapidated salvage ship on shot-in-the-dark missions into the Void, where the war-ending cataclysm had occurred. The nature of the recovery missions meant that extensive shoreside leave on Terra was required for each crew sent out, and this did not please the bean counters.

After some time in this state, that lone salvage crew had crawled back into the Niffleheim system, barely towing a sizeable chunk of the Golem back. While the loadmasters were identifying and inspecting the prize, Calvin asked the lucky vessel's captain what had happened:

"Well, as per standard operating procedure," the captain grimaced, since such words were only used as a nod to the Senate, "we used the ship's reactor's radioactivity to generate a set of random jump coordinates constrained by the expected target space and known stellar obstructions. When our Drive popped us through, we found ourselves heading into orbit around one of the Darkened Suns." The captain paused, waiting for Calvin to urge him on. Those suns had been extinguished in the Golem's contrapuntal feedback event, and physics didn't quite work right around them.

Acknowledging the captain's obvious dismay at this detail, he urged him on. "We were sixteen AUs or so out, so we started the regular ten-light-minute scans, and stepped them up to full system scans. Something in the far hemisphere interfered with the Oort cloud's return of the FTL probe, so we cautiously microhopped over to see what it was..." The captain droned on about the routine details of crossing the star system. Heh. Microhopping was basically the least cautious approach that could have been used...it set off tachyon flares visible for about a lightyear. "...and when the Golem architecturalist on the crew identified it as a fragment, we started dragging it in. It's about four times a massive as it should be, but, with some ingenuity on our engine man's part, we got it here."

"Did you run much more than the simple architecture analytics on it?" Calvin probed.

The captain narrowed his eyes. "Are you not telling me something about my cargo? After fifteen of these missions, jumping blindly into who knows where, we find something, and all you can ask is whether I ran a few extra ********* scans?! Of course we didn't, sir, we were worried enough about getting it back here without a catastrophic drive failure of our own!"

That...was not what he had expected. He guessed that more unexpected things would follow quickly enough... "Captain Morris, you know everything I know. I just had a hunch and wanted to know if you had any small details that might be useful later. We both know it was a drive-related explosion, so I was just worried about contamination from that. The repair crews aren't daft; they know too and they'll be careful."

After a few more questions about the return trip, the captain left, still somewhat frazzled, and Calvin began pacing his office.