/**********************************************************************************
|
/**********************************************************************************
|
* *
|
* *
|
* This verilog file is a part of the Boundary Scan Implementation and comes in *
|
* This verilog file is a part of the Boundary Scan Implementation and comes in *
|
* a pack with several other files. It is fully IEEE 1149.1 compliant. *
|
* a pack with several other files. It is fully IEEE 1149.1 compliant. *
|
* For details check www.opencores.org (pdf files, bsdl file, etc.) *
|
* For details check www.opencores.org (pdf files, bsdl file, etc.) *
|
* *
|
* *
|
* Copyright (C) 2000 Igor Mohor (igorm@opencores.org) and OPENCORES.ORG *
|
* Copyright (C) 2000 Igor Mohor (igorm@opencores.org) and OPENCORES.ORG *
|
* *
|
* *
|
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
* (at your option) any later version. *
|
* (at your option) any later version. *
|
* *
|
* *
|
* See the file COPYING for the full details of the license. *
|
* See the file COPYING for the full details of the license. *
|
* *
|
* *
|
* OPENCORES.ORG is looking for new open source IP cores and developers that *
|
* OPENCORES.ORG is looking for new open source IP cores and developers that *
|
* would like to help in our mission. *
|
* would like to help in our mission. *
|
* *
|
* *
|
**********************************************************************************/
|
**********************************************************************************/
|
|
|
|
|
|
|
/**********************************************************************************
|
/**********************************************************************************
|
* *
|
* *
|
* Output Cell: *
|
* Output Cell: *
|
* *
|
* *
|
* FromCore: Value that comes from on-chip logic and goes to pin *
|
* FromCore: Value that comes from on-chip logic and goes to pin *
|
* FromPreviousBSCell: Value from previous boundary scan cell *
|
* FromPreviousBSCell: Value from previous boundary scan cell *
|
* ToNextBSCell: Value for next boundary scan cell *
|
* ToNextBSCell: Value for next boundary scan cell *
|
* CaptureDR, ShiftDR, UpdateDR: TAP states *
|
* CaptureDR, ShiftDR, UpdateDR: TAP states *
|
* extest: Instruction Register Command *
|
* extest: Instruction Register Command *
|
* TCK: Test Clock *
|
* TCK: Test Clock *
|
* TristatedPin: Signal from core is connected to this output pin via BS *
|
* TristatedPin: Signal from core is connected to this output pin via BS *
|
* FromOutputEnable: This pin comes from core or ControlCell *
|
* FromOutputEnable: This pin comes from core or ControlCell *
|
* *
|
* *
|
* Signal that is connected to TristatedPin comes from core or BS chain. *
|
* Signal that is connected to TristatedPin comes from core or BS chain. *
|
* Tristate control is generated in core or BS chain (ControlCell). *
|
* Tristate control is generated in core or BS chain (ControlCell). *
|
* *
|
* *
|
**********************************************************************************/
|
**********************************************************************************/
|
|
|
// This is not a top module
|
// This is not a top module
|
module OutputCell( FromCore, FromPreviousBSCell, CaptureDR, ShiftDR, UpdateDR, extest, TCK, ToNextBSCell, FromOutputEnable, TristatedPin);
|
module OutputCell( FromCore, FromPreviousBSCell, CaptureDR, ShiftDR, UpdateDR, extest, TCK, ToNextBSCell, FromOutputEnable, TristatedPin);
|
input FromCore;
|
input FromCore;
|
input FromPreviousBSCell;
|
input FromPreviousBSCell;
|
input CaptureDR;
|
input CaptureDR;
|
input ShiftDR;
|
input ShiftDR;
|
input UpdateDR;
|
input UpdateDR;
|
input extest;
|
input extest;
|
input TCK;
|
input TCK;
|
input FromOutputEnable;
|
input FromOutputEnable;
|
|
|
reg Latch;
|
reg Latch;
|
|
|
output ToNextBSCell;
|
output ToNextBSCell;
|
reg ToNextBSCell;
|
reg ToNextBSCell;
|
|
|
output TristatedPin;
|
output TristatedPin;
|
|
|
reg ShiftedControl;
|
reg ShiftedControl;
|
|
|
wire SelectedInput = CaptureDR? FromCore : FromPreviousBSCell;
|
wire SelectedInput = CaptureDR? FromCore : FromPreviousBSCell;
|
|
|
always @ (posedge TCK)
|
always @ (posedge TCK)
|
begin
|
begin
|
if(CaptureDR | ShiftDR)
|
if(CaptureDR | ShiftDR)
|
Latch<=SelectedInput;
|
Latch<=SelectedInput;
|
end
|
end
|
|
|
always @ (negedge TCK)
|
always @ (negedge TCK)
|
begin
|
begin
|
ToNextBSCell<=Latch;
|
ToNextBSCell<=Latch;
|
end
|
end
|
|
|
always @ (negedge TCK)
|
always @ (negedge TCK)
|
begin
|
begin
|
if(UpdateDR)
|
if(UpdateDR)
|
ShiftedControl<=ToNextBSCell;
|
ShiftedControl<=ToNextBSCell;
|
end
|
end
|
|
|
wire MuxedSignal = extest? ShiftedControl : FromCore;
|
wire MuxedSignal = extest? ShiftedControl : FromCore;
|
assign TristatedPin = FromOutputEnable? MuxedSignal : 1'bz;
|
assign TristatedPin = FromOutputEnable? MuxedSignal : 1'bz;
|
|
|
|
|