Restore the deleted unused params to be backword compatible. Handle the case where the d_process instance has a null in vector, so that N_din is zero. This allows the model to be just a pattern generator. Add include to cmproto.h to avoid a forward ref. to an enum type.
This commit is contained in:
parent
d114715d99
commit
074355f830
|
|
@ -49,6 +49,7 @@ NON-STANDARD FEATURES
|
|||
#include <stdio.h>
|
||||
#include "ngspice/cmtypes.h"
|
||||
#include "ngspice/cktdefs.h"
|
||||
#include "ngspice/cpextern.h"
|
||||
|
||||
|
||||
void cm_climit_fcn(double in, double in_offset, double cntl_upper,
|
||||
|
|
|
|||
|
|
@ -80,9 +80,6 @@ MODIFICATIONS
|
|||
For Windows VisualC and Mingw the pipes use binary mode, and
|
||||
named pipes or fifos are not supported.
|
||||
|
||||
8 October 2023 Brian Taylor
|
||||
Remove reset_delay param from ifspec.ifs since the clk_delay
|
||||
is used with synchronous reset.
|
||||
|
||||
REFERENCED FILES
|
||||
|
||||
|
|
@ -191,7 +188,11 @@ static void dprocess_exchangedata(Process_t * process, double time, uint8_t din[
|
|||
int wlen = 0;
|
||||
packet_t packet;
|
||||
packet.time = time;
|
||||
memcpy(packet.din, din, process->N_din);
|
||||
if (process->N_din > 0) {
|
||||
memcpy(packet.din, din, process->N_din);
|
||||
} else {
|
||||
packet.din[0] = 0;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW64__)
|
||||
wlen = _write(process->pipe_to_child, &packet, sizeof(double) + process->N_din);
|
||||
|
|
@ -338,6 +339,12 @@ void cm_d_process(ARGS)
|
|||
#endif
|
||||
sendheader(local_process, PORT_SIZE(in), PORT_SIZE(out));
|
||||
|
||||
if (PORT_SIZE(in) == 0) {
|
||||
if (local_process->N_din != 0) {
|
||||
fprintf(stderr, "Error: in port size mismatch\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
for (i=0; i<PORT_SIZE(in); i++) {
|
||||
LOAD(in[i]) = PARAM(input_load);
|
||||
}
|
||||
|
|
@ -377,11 +384,13 @@ void cm_d_process(ARGS)
|
|||
}
|
||||
|
||||
if (*clk != *clk_old && ONE == *clk) {
|
||||
uint8_t *dout, *din;
|
||||
uint8_t *dout = NULL, *din = NULL;
|
||||
uint8_t b;
|
||||
dout = (uint8_t *) malloc(local_process->N_dout * sizeof(uint8_t));
|
||||
din = (uint8_t *) malloc(local_process->N_din * sizeof(uint8_t));
|
||||
memset(din, 0, local_process->N_din);
|
||||
dout = (uint8_t *)malloc(local_process->N_dout * sizeof(uint8_t));
|
||||
if (local_process->N_din > 0) {
|
||||
din = (uint8_t *)malloc(local_process->N_din * sizeof(uint8_t));
|
||||
memset(din, 0, local_process->N_din);
|
||||
}
|
||||
|
||||
for (i=0; i<PORT_SIZE(in); i++) {
|
||||
switch(INPUT_STATE(in[i])) {
|
||||
|
|
@ -411,8 +420,8 @@ void cm_d_process(ARGS)
|
|||
OUTPUT_CHANGED(out[i]) = FALSE;
|
||||
}
|
||||
}
|
||||
free(din);
|
||||
free(dout);
|
||||
if (din) free(din);
|
||||
if (dout) free(dout);
|
||||
}
|
||||
else {
|
||||
for (i=0; i<PORT_SIZE(out); i++) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ Default_Type: d d
|
|||
Allowed_Types: [d] [d]
|
||||
Vector: yes no
|
||||
Vector_Bounds: - -
|
||||
Null_Allowed: no no
|
||||
Null_Allowed: yes no
|
||||
|
||||
|
||||
PORT_TABLE:
|
||||
|
|
@ -47,21 +47,21 @@ Default_Type: d d
|
|||
Allowed_Types: [d] [d]
|
||||
Vector: no yes
|
||||
Vector_Bounds: - [1 -]
|
||||
Null_Allowed: yes no
|
||||
Null_Allowed: yes yes
|
||||
|
||||
|
||||
|
||||
PARAMETER_TABLE:
|
||||
|
||||
|
||||
Parameter_Name: clk_delay
|
||||
Description: "delay from CLK"
|
||||
Data_Type: real
|
||||
Default_Value: 1.0e-9
|
||||
Limits: -
|
||||
Vector: no
|
||||
Vector_Bounds: -
|
||||
Null_Allowed: yes
|
||||
Parameter_Name: clk_delay reset_delay
|
||||
Description: "delay from CLK" "delay from reset"
|
||||
Data_Type: real real
|
||||
Default_Value: 1.0e-9 1.0e-9
|
||||
Limits: - -
|
||||
Vector: no no
|
||||
Vector_Bounds: - -
|
||||
Null_Allowed: yes yes
|
||||
|
||||
|
||||
PARAMETER_TABLE:
|
||||
|
|
@ -93,6 +93,19 @@ Null_Allowed: yes
|
|||
PARAMETER_TABLE:
|
||||
|
||||
|
||||
Parameter_Name: reset_state
|
||||
Description: "default state on RESET & at DC"
|
||||
Data_Type: int
|
||||
Default_Value: 0
|
||||
Limits: -
|
||||
Vector: no
|
||||
Vector_Bounds: -
|
||||
Null_Allowed: no
|
||||
|
||||
|
||||
PARAMETER_TABLE:
|
||||
|
||||
|
||||
Parameter_Name: input_load
|
||||
Description: "input loading capacitance (F)"
|
||||
Data_Type: real
|
||||
|
|
|
|||
Loading…
Reference in New Issue