--- Quote Start ---
My goal is to tri-state the outputs which aren't active.
--- Quote End ---
Right, but what is the
active state supposed to be? Driven high or low?
--- Quote Start ---
I will have pull up/down resistors on every output which give them a default state. I haven't yet decided whether to use pull up or downs. I think eventually I will go with pull ups if I can get a 4-layer board manufactured. It will make laying the pull up resistor quite easy.
--- Quote End ---
Can you just use the weak pull-ups on the FPGA?
--- Quote Start ---
One thing that I am sort of concerned about - if I use a pull down, will it interfere with the programmable pull up resistor? I'm not using that on purpose.
--- Quote End ---
No, you just have to use a pull-down that is stronger (smaller resistance) than the pull-up (which is ~20kOhm I think).
--- Quote Start ---
Based upon Daixiwen suggestion, I changed my code to a If... else and here's what it looks now. I couldn't get the when statement to compile.
--- Quote End ---
Sorry about that; the when statement works inside a generate loop, but not inside a process loop. You've got the code right now. Here's a couple of style changes ...
library ieee;
use ieee.std_logic_1164.all;
entity SerialInParallelOut is
port(CLK, SI, Reset : in std_logic;
POut : out std_logic_vector(29 downto 0));
end SerialInParallelOut;
architecture shift of SerialInParallelOut is
constant WIDTH : integer := 30;
signal tmp: std_logic_vector(POut'high downto POut'low);
begin
process(CLK,Reset)
begin
if Reset = '1' then
tmp <= (others => '0');
elsif rising_edge(CLK) then
tmp <= tmp(WIDTH - 2 downto 0) & SI;
end if;
end process;
process(tmp)
begin
for i in 0 to WIDTH-1 loop
if tmp(i) = '0' then
POut(i) <= 'Z';
else
POut(i) <= '1';
end if;
end loop;
end process;
end shift;
--- Quote Start ---
You mention a
weak pull up enable constraint. Pardon my ignorance, but I'm not quite sure what you're referring to.
--- Quote End ---
Given a pin on the FPGA called foo, you can enable the weak pull-up using the Tcl command
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to foo
See p720-721
http://www.altera.com/literature/manual/mnl_qsf_reference.pdf --- Quote Start ---
Perhaps some background maybe useful: the shift register's parallel out will be connected to wires that it's supposed to test for short circuits. The parallel out will basically have a "walking one" test vector loaded onto it. The wire that was being tested had a '1' and the other had a '0' on it. If they're shorted, the output pins would fight each other because they'd be trying to drive the same signal. But if I instead make the inactive pin high impedance, it'll be inactive and this situation won't arrive. At the same time, the wire will have a default value due to the pull up/down resistor.
--- Quote End ---
So why not use the pull-up on one end, and the shift-register driving a 0 on the other.
Cheers,
Dave