1- /*
2- Progres - Simulador de circuitos combinacionais em Verilog
3- (C) 2014, 2015 Tiago Matos Santos
1+ /********************************
2+ Progres - Verilog Simulator
3+ (C) 2014-2025 Tiago Matos
44
5- Under the terms of the MIT license.
6- */
5+ Under terms of the MIT license.
6+ ********************************* /
77
88#include <stdio.h>
99#include <stdlib.h>
1717#include "erros.h"
1818#include "mem.h"
1919
20- Module * novoCircuito ()
20+ Module * new_module ()
2121{
2222 Module * circuito = (Module * ) xmalloc (sizeof (Module ));
2323
24- circuito -> listaFiosEntrada = novaListaComponente ();
24+ circuito -> listaFiosEntrada = new_list_component ();
2525 circuito -> sinaisEntrada = NULL ;
2626
27- circuito -> listaFiosSaida = novaListaComponente ();
27+ circuito -> listaFiosSaida = new_list_component ();
2828 circuito -> sinaisSaida = NULL ;
2929
30- circuito -> listaWires = novaListaComponente ();
30+ circuito -> listaWires = new_list_component ();
3131
32- circuito -> listaPortas = novaListaComponente ();
32+ circuito -> listaPortas = new_list_component ();
3333
3434 circuito -> listaReg .total = 0 ;
3535 circuito -> listaReg .itens = NULL ;
@@ -73,49 +73,49 @@ void free_module(Module** mod)
7373 * mod = NULL ;
7474}
7575
76- void adicionaEntrada (Module * circ , Component * comp )
76+ void add_input (Module * circ , Component * comp )
7777{
7878 if (!circ || !comp )
7979 return ;
8080
81- insereComponente (circ -> listaFiosEntrada , comp );
81+ insert_component (circ -> listaFiosEntrada , comp );
8282}
8383
84- void adicionaSaida (Module * circ , Component * comp )
84+ void add_output (Module * circ , Component * comp )
8585{
8686 if (!circ || !comp )
8787 return ;
8888
89- insereComponente (circ -> listaFiosSaida , comp );
89+ insert_component (circ -> listaFiosSaida , comp );
9090}
9191
92- void adicionaWire (Module * circ , Component * comp )
92+ void add_wire (Module * circ , Component * comp )
9393{
9494 if (!circ || !comp )
9595 return ;
9696
97- insereComponente (circ -> listaWires , comp );
97+ insert_component (circ -> listaWires , comp );
9898}
9999
100- void adicionaPorta (Module * circ , Component * comp )
100+ void add_gate (Module * circ , Component * comp )
101101{
102102 if (!circ || !comp )
103103 return ;
104104
105- insereComponente (circ -> listaPortas , comp );
105+ insert_component (circ -> listaPortas , comp );
106106}
107107
108- ListaComponente * novaListaComponente ()
108+ ListComponent * new_list_component ()
109109{
110- return novaListaComponenteTamanho (0 );
110+ return new_list_component_of_size (0 );
111111}
112112
113- ListaComponente * novaListaComponenteTamanho (unsigned int size )
113+ ListComponent * new_list_component_of_size (unsigned int size )
114114{
115115 unsigned int i ;
116- ListaComponente * list_comp ;
116+ ListComponent * list_comp ;
117117
118- list_comp = (ListaComponente * ) xmalloc ( sizeof (ListaComponente ) );
118+ list_comp = (ListComponent * ) xmalloc ( sizeof (ListComponent ) );
119119 list_comp -> tamanho = size ;
120120
121121 if (size == 0 ) {
@@ -132,7 +132,7 @@ ListaComponente* novaListaComponenteTamanho(unsigned int size)
132132 return list_comp ;
133133}
134134
135- void delete_list_component (ListaComponente * * ppl )
135+ void delete_list_component (ListComponent * * ppl )
136136{
137137 if ( * ppl == NULL )
138138 return ;
@@ -154,7 +154,7 @@ void delete_list_component(ListaComponente** ppl)
154154 * ppl = NULL ;
155155}
156156
157- void insereComponente ( ListaComponente * ls , Component * cp )
157+ void insert_component ( ListComponent * ls , Component * cp )
158158{
159159 ls -> tamanho ++ ;
160160
@@ -168,7 +168,7 @@ void insereComponente(ListaComponente* ls, Component* cp)
168168 ls -> itens [ls -> tamanho - 1 ] = cp ;
169169}
170170
171- void addRegister (Module * circ , const char * name , unsigned int size , int is_signed )
171+ void add_register (Module * circ , const char * name , unsigned int size , int is_signed )
172172{
173173 Register * reg = (Register * ) xmalloc (sizeof (Register ));
174174
@@ -206,7 +206,7 @@ Register* get_reg_by_name(ListaReg list, const char* name)
206206 return NULL ;
207207}
208208
209- void addParam (Module * circ , Param * param )
209+ void add_param (Module * circ , Param * param )
210210{
211211 if (circ -> listaParam .total == 0 ) {
212212 circ -> listaParam .total ++ ;
@@ -237,7 +237,7 @@ Param* get_param_by_name(ListaParam list, const char* name)
237237 return NULL ;
238238}
239239
240- int contemComponente ( ListaComponente * ls , Component * cp )
240+ int has_component_by_pointer ( ListComponent * ls , Component * cp )
241241{
242242 int i ;
243243
@@ -253,7 +253,7 @@ int contemComponente(ListaComponente* ls, Component* cp)
253253 return 0 ;
254254}
255255
256- Component * novoComponente (const char * nome , t_operador porta )
256+ Component * new_component (const char * nome , t_operador porta )
257257{
258258 Component * c = (Component * ) xmalloc ( sizeof (Component ) );
259259
@@ -267,8 +267,8 @@ Component* novoComponente(const char* nome, t_operador porta)
267267 c -> sinalSaida = NULL ;
268268
269269 if (porta != LITERAL_NUMBER ) {
270- c -> listaEntrada = novaListaComponente ();
271- c -> listaSaida = novaListaComponente ();
270+ c -> listaEntrada = new_list_component ();
271+ c -> listaSaida = new_list_component ();
272272 }
273273
274274 c -> valorDinamico = VAL_X ;
@@ -299,7 +299,7 @@ void delete_componente(Component** c)
299299 * c = NULL ;
300300}
301301
302- Component * getComponenteItemPorNome ( ListaComponente * ls , const char * nome )
302+ Component * get_component_by_name ( ListComponent * ls , const char * nome )
303303{
304304 int i ;
305305
@@ -315,34 +315,34 @@ Component* getComponenteItemPorNome(ListaComponente* ls, const char* nome)
315315 return NULL ;
316316}
317317
318- Component * getPortaPorNome (Module * circ , const char * nome )
318+ Component * get_gate_by_name (Module * circ , const char * nome )
319319{
320320 if (!circ || !nome )
321321 return NULL ;
322322
323- return getComponenteItemPorNome (circ -> listaPortas , nome );
323+ return get_component_by_name (circ -> listaPortas , nome );
324324}
325325
326- Component * getWirePorNome (Module * circ , const char * nome )
326+ Component * get_wire_by_name (Module * circ , const char * nome )
327327{
328328 if (!circ || !nome )
329329 return NULL ;
330330
331- return getComponenteItemPorNome (circ -> listaWires , nome );
331+ return get_component_by_name (circ -> listaWires , nome );
332332}
333333
334- Component * getInputPorNome (Module * circ , const char * nome )
334+ Component * get_input_by_name (Module * circ , const char * nome )
335335{
336336 if (!circ || !nome )
337337 return NULL ;
338338
339- return getComponenteItemPorNome (circ -> listaFiosEntrada , nome );
339+ return get_component_by_name (circ -> listaFiosEntrada , nome );
340340}
341341
342- Component * getOutputPorNome (Module * circ , const char * nome )
342+ Component * get_output_by_name (Module * circ , const char * nome )
343343{
344344 if (!circ || !nome )
345345 return NULL ;
346346
347- return getComponenteItemPorNome (circ -> listaFiosSaida , nome );
347+ return get_component_by_name (circ -> listaFiosSaida , nome );
348348}
0 commit comments