diff --git a/ivl_target.h b/ivl_target.h index bb01a6426..14062fabd 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: ivl_target.h,v 1.145 2005/03/05 05:47:42 steve Exp $" +#ident "$Id: ivl_target.h,v 1.146 2005/03/09 04:53:40 steve Exp $" #endif #ifdef __cplusplus @@ -837,6 +837,18 @@ extern const char* ivl_udp_name(ivl_udp_t net); * are. All the data inputs have the same width, the width of the * ivl_lpm_q output. * + * - Memory port (IVL_LPM_RAM) + * These are structural ports into a memory device. They represent + * address/data ports of a memory device that the context can hook to + * for read or write. Read devices have an ivl_lpm_q output port that + * is the data being read. + * + * The ivl_lpm_memory function returns the ivl_memory_t for the memory + * that the port access. The ivl_lpm_width for the port then must + * match the ivl_memory_width of the memory device. + * + * Read or write, the ivl_lpm_select nexus is the address. + * * - Reduction operators (IVL_LPM_RE_*) * These devices have one input, a vector, and generate a single bit * result. The width from the ivl_lpm_width is the width of the input @@ -1544,6 +1556,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.146 2005/03/09 04:53:40 steve + * Generate code for new form of memory ports. + * * Revision 1.145 2005/03/05 05:47:42 steve * Handle memory words in l-value concatenations. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index a012a9cb4..2c99c9570 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: stub.c,v 1.113 2005/03/05 05:47:42 steve Exp $" +#ident "$Id: stub.c,v 1.114 2005/03/09 04:53:40 steve Exp $" #endif # include "config.h" @@ -483,6 +483,34 @@ static void show_lpm_part(ivl_lpm_t net) } } +static void show_lpm_ram(ivl_lpm_t net) +{ + ivl_nexus_t nex; + unsigned width = ivl_lpm_width(net); + ivl_memory_t mem = ivl_lpm_memory(net); + + fprintf(out, " LPM_RAM: \n", width); + nex = ivl_lpm_q(net, 0); + fprintf(out, " Q: %s\n", ivl_nexus_name(nex)); + nex = ivl_lpm_select(net, 0); + fprintf(out, " Address: %s\n", ivl_nexus_name(nex)); + + + if (width_of_nexus(ivl_lpm_q(net,0)) != width) { + fprintf(out, " ERROR: Data width doesn't match nexus width=%u\n", + width_of_nexus(ivl_lpm_q(net,0))); + stub_errors += 1; + } + + /* The width of the port must match the width of the memory + word. the compile assures that for us. */ + if (width != ivl_memory_width(mem)) { + fprintf(out, " ERROR: Width doesn't match memory word width=%u\n", + ivl_memory_width(mem)); + stub_errors += 1; + } +} + /* * The reduction operators have similar characteristics and are * displayed here. @@ -596,6 +624,10 @@ static void show_lpm(ivl_lpm_t net) show_lpm_concat(net); break; + case IVL_LPM_RAM: + show_lpm_ram(net); + break; + case IVL_LPM_RE_AND: show_lpm_re(net); break; @@ -1137,6 +1169,9 @@ int target_design(ivl_design_t des) /* * $Log: stub.c,v $ + * Revision 1.114 2005/03/09 04:53:40 steve + * Generate code for new form of memory ports. + * * Revision 1.113 2005/03/05 05:47:42 steve * Handle memory words in l-value concatenations. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 804d03115..3861abbc7 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_scope.c,v 1.119 2005/02/13 01:15:07 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.120 2005/03/09 04:53:40 steve Exp $" #endif # include "vvp_priv.h" @@ -1250,11 +1250,8 @@ static void draw_event_in_scope(ivl_event_t obj) } } -inline static void draw_lpm_ram(ivl_lpm_t net) +static void draw_lpm_ram(ivl_lpm_t net) { - unsigned idx; - unsigned width = ivl_lpm_width(net); - unsigned awidth = ivl_lpm_selects(net); ivl_memory_t mem = ivl_lpm_memory(net); ivl_nexus_t clk = ivl_lpm_clk(net); ivl_nexus_t pin; @@ -1265,31 +1262,22 @@ inline static void draw_lpm_ram(ivl_lpm_t net) fprintf(vvp_out, ";\n"); } - fprintf(vvp_out, "L_%p .mem/port", net); - fprintf(vvp_out, - " M_%s, %d,0, %d,\n ", - vvp_memory_label(mem), - width-1, - awidth); + fprintf(vvp_out, "L_%p .mem/port M_%s, ", net, vvp_memory_label(mem)); - for (idx = 0 ; idx < awidth ; idx += 1) { - pin = ivl_lpm_select(net, idx); - if (idx) fprintf(vvp_out, ", "); - draw_input_from_net(pin); - } + pin = ivl_lpm_select(net,0); + draw_input_from_net(pin); if (clk) { - fprintf(vvp_out, ",\n CLK_%p, ", net); + fprintf(vvp_out, ", CLK_%p, ", net); pin = ivl_lpm_enable(net); if (pin) draw_input_from_net(pin); else fprintf(vvp_out, "C<1>"); - for (idx=0; idx