Skip to content

Commit

Permalink
Various tweaks to Dac test case. Updated documentation to reflect tha…
Browse files Browse the repository at this point in the history
…t inference of parallel counter outputs to DACs is now supported
azonenberg committed May 23, 2017
1 parent 39f583b commit 7899229
Showing 3 changed files with 13 additions and 36 deletions.
8 changes: 3 additions & 5 deletions doc/gp4-hdl.tex
Original file line number Diff line number Diff line change
@@ -806,9 +806,9 @@ \subsection{Counters}
\namestyle{Yosys} provides limited inference capability for counters which match the capabilities of the hard macro counters
(\tokenref{GP\_COUNT8}{gp-count8} and \tokenref{GP\_COUNT14}{gp-count14}) in the device.

Some hard macro capabilities (most notably input dividers and parallel output to DCMP/DAC blocks) are not yet supported
for inference; if these capabilities are required then use explicit primitive instantiation. Future software releases
will expand the set of counter features which may be inferred.
Some hard macro capabilities (most notably input dividers) are not yet supported for inference; if these capabilities
are required then use explicit primitive instantiation. Future software releases will expand the set of counter
features which may be inferred.

\subsubsection{Inference Requirements}

@@ -819,8 +819,6 @@ \subsubsection{Inference Requirements}
\item Count down only
\item Be initialized to the same (maximum) value by both underflow and by power-on reset
\item Have either no reset, or a positive level triggered reset to zero
\item Not have any logic use the internal counter register. Only the ``underflow" signal may be used by surrounding
logic.
\end{itemize}

\subsubsection{Counter Related Constraints}
3 changes: 2 additions & 1 deletion tests/greenpak4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -24,7 +24,8 @@ function(add_greenpak4_netlist name part)

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.json"
COMMAND "${YOSYS_COMMAND}" -q
COMMAND "${YOSYS_COMMAND}"
-q
-p "read_verilog ${CMAKE_CURRENT_SOURCE_DIR}/${name}.v"
-p "synth_greenpak4 -top ${name} -part ${part}"
-p "write_json ${CMAKE_CURRENT_BINARY_DIR}/${name}.json"
38 changes: 8 additions & 30 deletions tests/greenpak4/slg46620v/Dac.v
Original file line number Diff line number Diff line change
@@ -98,10 +98,7 @@ module Dac(bg_ok, vout, vout2, wave_sync);

localparam COUNT_MAX = 255;

//TODO: support for inference of counters with parallel output
/*
(* LOC = "COUNT8_6" *)
(* COUNT_EXTRACT = "FORCE" *)
//Inferred counter that drives both the DAC and an overflow output
reg[7:0] count = COUNT_MAX;
always @(posedge clk_1730hz) begin
if(count == 0)
@@ -112,32 +109,19 @@ module Dac(bg_ok, vout, vout2, wave_sync);

//Counter overflow signal to LED
assign wave_sync = (count == 0);
*/

//Explicitly instantiated counter b/c we don't yet have inference support when using POUT
wire[7:0] count_pout;
GP_COUNT8 #(
.CLKIN_DIVIDE(1),
.COUNT_TO(COUNT_MAX),
.RESET_MODE("RISING")
) cnt (
.CLK(clk_1730hz),
.RST(1'b0),
.OUT(wave_sync),
.POUT(count_pout)
);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// DAC driving the voltage reference
// The DACs

wire vdac;
//This one drives a top-level output pin directly (GP_VREF and GP_ACMP are infrred)
(* LOC = "DAC_1" *)
GP_DAC dac(
.DIN(count_pout),
.VOUT(vdac),
.DIN(count),
.VOUT(vout),
.VREF(vref_1v0)
);

//This one drives a GP_VREF explicitly (GP_ACMP is inferred)
wire vdac2;
(* LOC = "DAC_0" *)
GP_DAC dac2(
@@ -146,21 +130,15 @@ module Dac(bg_ok, vout, vout2, wave_sync);
.VREF(vref_1v0)
);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Drive one pin with the DAC output directly, no vref

//assign vout = vdac;
assign vout2 = vdac2;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Drive the other via a buffered reference

GP_VREF #(
.VIN_DIV(4'd1),
.VREF(16'd00)
) vrdac (
.VIN(vdac),
.VOUT(vout)
.VIN(vdac2),
.VOUT(vout2)
);


0 comments on commit 7899229

Please sign in to comment.