W
WindowsGeek
Guest
I'm a novice at Verilog. I'm writing some glue logic to shift out data
over SPI. My problem code is this:
always @(negedge SPISS)
begin
ADCSPIShifter <= ADCTemp;
end
always @(posedge SPICLK)
begin
SPIMISO = ADCSPIShifter[63];
ADCSPIShifter = ADCSPIShifter << 1;
end
I have a register, ADCTemp, that I created in a different clock
domain. I want to shift this data out over an SPI bus. When the chip
select line (SPISS) goes low, I load the shift register from the
ADCTemp register. On each rising edge of the SPICLK, I want to shift
out a bit of the register.
I know that I'm driving ADCSPIShifter from two sources. I just can't
figure out how to solve it. The chip select line and the SPI clock
line should never transition at the same time, but I don't know how to
tell the synthesizer about that guarantee.
I'm certain there's an easy prepackaged solution to this problem that
everyone who knows anything about Verilog knows. I'm just not one of
those people who learned Verilog the right way. If anyone can suggest
a solution, I'd sure appreciate it.
over SPI. My problem code is this:
always @(negedge SPISS)
begin
ADCSPIShifter <= ADCTemp;
end
always @(posedge SPICLK)
begin
SPIMISO = ADCSPIShifter[63];
ADCSPIShifter = ADCSPIShifter << 1;
end
I have a register, ADCTemp, that I created in a different clock
domain. I want to shift this data out over an SPI bus. When the chip
select line (SPISS) goes low, I load the shift register from the
ADCTemp register. On each rising edge of the SPICLK, I want to shift
out a bit of the register.
I know that I'm driving ADCSPIShifter from two sources. I just can't
figure out how to solve it. The chip select line and the SPI clock
line should never transition at the same time, but I don't know how to
tell the synthesizer about that guarantee.
I'm certain there's an easy prepackaged solution to this problem that
everyone who knows anything about Verilog knows. I'm just not one of
those people who learned Verilog the right way. If anyone can suggest
a solution, I'd sure appreciate it.